home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / jikes.lha / jikes-1.11 / src / javaact.cpp < prev    next >
C/C++ Source or Header  |  1999-10-20  |  110KB  |  4,577 lines

  1. #line 427 "java.g"
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler Open
  4. // Source License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10.  
  11. #include "config.h"
  12. #include "parser.h"
  13. #include "ast.h"
  14.  
  15. #undef HEADERS
  16. #include "javaact.h"
  17.  
  18. //****************************************************************************//
  19. //****************************************************************************//
  20. //*                                                                          *//
  21. //* Below, we show each rule of the Java grammar together with the semantic  *//
  22. //* action that is invoked when the parser performs a reduction by that rule.*//
  23. //*                                                                          *//
  24. //****************************************************************************//
  25. //****************************************************************************//
  26.  
  27.  
  28. //
  29. // Rule 1:  Goal -> CompilationUnit
  30. //
  31. #line 459 "java.g"
  32. //
  33. // Given a rule of the form A ::= x1 x2 ... xn        n >= 1
  34. //
  35. // Do nothing - Whatever Ast was produced for x1 is inherited by A.
  36. //
  37. void Parser::BadAction(void) { assert(false); }
  38. void Parser::NoAction(void) {}
  39.  
  40. //
  41. // Rule 2:  Goal ::= BodyMarker ConstructorBody
  42. //
  43. #line 471 "java.g"
  44. //
  45. // This rule was added to allow the parser to recognize the body of a
  46. // funtion (constructor or method, as the definition of the body of a
  47. // method is subsumed by the definition of the body of a constructor)
  48. // out of context. Note that the artificial terminal BodyMarker is
  49. // added here to prevent an ordinary parse from accepting a body as
  50. // a valid input - i.e., to recognize a body out-of-context, the
  51. // BodyMarker terminal must be inserted in front of the input stream
  52. // containing the body in question.
  53. //
  54. void Parser::Act2(void)
  55. {
  56.     Sym(1) = Sym(2);
  57. }
  58.  
  59. //
  60. // Rule 3:  Literal ::= IntegerLiteral
  61. //
  62. #line 496 "java.g"
  63. void Parser::Act3(void)
  64. {
  65.     Sym(1) = ast_pool -> NewIntegerLiteral(Token(1));
  66. }
  67.  
  68. //
  69. // Rule 4:  Literal ::= LongLiteral
  70. //
  71. #line 505 "java.g"
  72. void Parser::Act4(void)
  73. {
  74.     Sym(1) = ast_pool -> NewLongLiteral(Token(1));
  75. }
  76.  
  77. //
  78. // Rule 5:  Literal ::= FloatingPointLiteral
  79. //
  80. #line 514 "java.g"
  81. void Parser::Act5(void)
  82. {
  83.     Sym(1) = ast_pool -> NewFloatingPointLiteral(Token(1));
  84. }
  85.  
  86. //
  87. // Rule 6:  Literal ::= DoubleLiteral
  88. //
  89. #line 523 "java.g"
  90. void Parser::Act6(void)
  91. {
  92.     Sym(1) = ast_pool -> NewDoubleLiteral(Token(1));
  93. }
  94.  
  95. //
  96. // Rule 7:  Literal -> BooleanLiteral
  97. //
  98. // void NoAction(void);
  99. //
  100.  
  101. //
  102. // Rule 8:  Literal ::= CharacterLiteral
  103. //
  104. #line 536 "java.g"
  105. void Parser::Act8(void)
  106. {
  107.     Sym(1) = ast_pool -> NewCharacterLiteral(Token(1));
  108. }
  109.  
  110. //
  111. // Rule 9:  Literal ::= StringLiteral
  112. //
  113. #line 545 "java.g"
  114. void Parser::Act9(void)
  115. {
  116.     Sym(1) = ast_pool -> NewStringLiteral(Token(1));
  117. }
  118.  
  119. //
  120. // Rule 10:  Literal ::= null
  121. //
  122. #line 554 "java.g"
  123. void Parser::Act10(void)
  124. {
  125.     Sym(1) = ast_pool -> NewNullLiteral(Token(1));
  126. }
  127.  
  128. //
  129. // Rule 11:  BooleanLiteral ::= true
  130. //
  131. #line 563 "java.g"
  132. void Parser::Act11(void)
  133. {
  134.     Sym(1) = ast_pool -> NewTrueLiteral(Token(1));
  135. }
  136.  
  137. //
  138. // Rule 12:  BooleanLiteral ::= false
  139. //
  140. #line 572 "java.g"
  141. void Parser::Act12(void)
  142. {
  143.     Sym(1) = ast_pool -> NewFalseLiteral(Token(1));
  144. }
  145.  
  146. //
  147. // Rule 13:  Type -> PrimitiveType
  148. //
  149. // void NoAction(void);
  150. //
  151.  
  152. //
  153. // Rule 14:  Type -> ReferenceType
  154. //
  155. // void NoAction(void);
  156. //
  157.  
  158. //
  159. // Rule 15:  PrimitiveType -> NumericType
  160. //
  161. // void NoAction(void);
  162. //
  163.  
  164. //
  165. // Rule 16:  PrimitiveType ::= boolean
  166. //
  167. #line 595 "java.g"
  168. void Parser::Act16(void)
  169. {
  170.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::BOOLEAN, Token(1));
  171. }
  172.  
  173. //
  174. // Rule 17:  NumericType -> IntegralType
  175. //
  176. // void NoAction(void);
  177. //
  178.  
  179. //
  180. // Rule 18:  NumericType -> FloatingPointType
  181. //
  182. // void NoAction(void);
  183. //
  184.  
  185. //
  186. // Rule 19:  IntegralType ::= byte
  187. //
  188. #line 612 "java.g"
  189. void Parser::Act19(void)
  190. {
  191.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::BYTE, Token(1));
  192. }
  193.  
  194. //
  195. // Rule 20:  IntegralType ::= short
  196. //
  197. #line 621 "java.g"
  198. void Parser::Act20(void)
  199. {
  200.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::SHORT, Token(1));
  201. }
  202.  
  203. //
  204. // Rule 21:  IntegralType ::= int
  205. //
  206. #line 630 "java.g"
  207. void Parser::Act21(void)
  208. {
  209.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::INT, Token(1));
  210. }
  211.  
  212. //
  213. // Rule 22:  IntegralType ::= long
  214. //
  215. #line 639 "java.g"
  216. void Parser::Act22(void)
  217. {
  218.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::LONG, Token(1));
  219. }
  220.  
  221. //
  222. // Rule 23:  IntegralType ::= char
  223. //
  224. #line 648 "java.g"
  225. void Parser::Act23(void)
  226. {
  227.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::CHAR, Token(1));
  228. }
  229.  
  230. //
  231. // Rule 24:  FloatingPointType ::= float
  232. //
  233. #line 657 "java.g"
  234. void Parser::Act24(void)
  235. {
  236.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::FLOAT, Token(1));
  237. }
  238.  
  239. //
  240. // Rule 25:  FloatingPointType ::= double
  241. //
  242. #line 666 "java.g"
  243. void Parser::Act25(void)
  244. {
  245.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::DOUBLE, Token(1));
  246. }
  247.  
  248. //
  249. // Rule 26:  ReferenceType -> ClassOrInterfaceType
  250. //
  251. // void NoAction(void);
  252. //
  253.  
  254. //
  255. // Rule 27:  ReferenceType -> ArrayType
  256. //
  257. // void NoAction(void);
  258. //
  259.  
  260. //
  261. // Rule 28:  ClassOrInterfaceType -> Name
  262. //
  263. // void NoAction(void);
  264. //
  265.  
  266. //
  267. // Rule 29:  ArrayType ::= PrimitiveType Dims
  268. //
  269. #line 695 "java.g"
  270. void Parser::MakeArrayType(void)
  271. {
  272.     AstArrayType *p = ast_pool -> NewArrayType();
  273.     p -> type     = Sym(1);
  274.     //
  275.     // The list of modifiers is guaranteed not empty
  276.     //
  277.     {
  278.         AstListNode *tail = (AstListNode *) Sym(2);
  279.         p -> AllocateBrackets(tail -> index + 1);
  280.         AstListNode *root = tail;
  281.         do
  282.         {
  283.             root = root -> next;
  284.             p -> AddBrackets((AstBrackets *) root -> element);
  285.         } while(root != tail);
  286.         FreeCircularList(tail);
  287.     }
  288.     Sym(1) = p;
  289. }
  290.  
  291. //
  292. // Rule 30:  ArrayType ::= Name Dims
  293. //
  294. // void MakeArrayType(void);
  295. //
  296.  
  297. //
  298. // Rule 31:  ClassType -> ClassOrInterfaceType
  299. //
  300. // void NoAction(void);
  301. //
  302.  
  303. //
  304. // Rule 32:  InterfaceType -> ClassOrInterfaceType
  305. //
  306. // void NoAction(void);
  307. //
  308.  
  309. //
  310. // Rule 33:  Name -> SimpleName
  311. //
  312. // void NoAction(void);
  313. //
  314.  
  315. //
  316. // Rule 34:  Name -> QualifiedName
  317. //
  318. // void NoAction(void);
  319. //
  320.  
  321. //
  322. // Rule 35:  SimpleName ::= Identifier
  323. //
  324. #line 745 "java.g"
  325. void Parser::MakeSimpleName(void)
  326. {
  327.     Sym(1) = ast_pool -> NewSimpleName(Token(1));
  328. }
  329.  
  330. //
  331. // Rule 36:  QualifiedName ::= Name DOT Identifier
  332. //
  333. #line 754 "java.g"
  334. void Parser::MakeFieldAccess(void)
  335. {
  336.     AstFieldAccess *p = ast_pool -> NewFieldAccess();
  337.     p -> base = (AstExpression *) Sym(1);
  338.     p -> dot_token = Token(2);
  339.     p -> identifier_token = Token(3);
  340.     Sym(1) = p;
  341. }
  342.  
  343. //
  344. // Rule 37:  CompilationUnit ::= PackageDeclarationopt ImportDeclarationsopt TypeDeclarationsopt
  345. //
  346. #line 769 "java.g"
  347. void Parser::Act37(void)
  348. {
  349.     AstCompilationUnit *p = ast_pool -> NewCompilationUnit();
  350.     p -> package_declaration_opt = (AstPackageDeclaration *) Sym(1);
  351.     if (Sym(2) != NULL)
  352.     {
  353.         AstListNode *tail = (AstListNode *) Sym(2);
  354.         p -> AllocateImportDeclarations(tail -> index + 1);
  355.         AstListNode *root = tail;
  356.         do
  357.         {
  358.             root = root -> next;
  359.             p -> AddImportDeclaration((AstImportDeclaration *) root -> element);
  360.         } while(root != tail);
  361.         FreeCircularList(tail);
  362.     }
  363.     if (Sym(3) != NULL)
  364.     {
  365.         AstListNode *tail = (AstListNode *) Sym(3);
  366.         p -> AllocateTypeDeclarations(tail -> index + 1);
  367.         AstListNode *root = tail;
  368.         do
  369.         {
  370.             root = root -> next;
  371.             p -> AddTypeDeclaration(root -> element);
  372.         } while(root != tail);
  373.         FreeCircularList(tail);
  374.     }
  375.     Sym(1) = p;
  376. }
  377.  
  378. //
  379. // Rule 38:  ImportDeclarations ::= ImportDeclaration
  380. //
  381. #line 804 "java.g"
  382. //
  383. // Note that the list is circular so as to preserve the order of the elements
  384. //
  385. void Parser::Act38(void)
  386. {
  387.     AstListNode *p = AllocateListNode();
  388.     p -> next = p;
  389.     p -> element = Sym(1);
  390.     p -> index = 0;
  391.  
  392.     Sym(1) = p;
  393. }
  394.  
  395. //
  396. // Rule 39:  ImportDeclarations ::= ImportDeclarations ImportDeclaration
  397. //
  398. #line 821 "java.g"
  399. //
  400. // Note that the list is circular so as to preserve the order of the elements
  401. //
  402. void Parser::Act39(void)
  403. {
  404.     AstListNode *tail = (AstListNode *) Sym(1);
  405.  
  406.     AstListNode *p = AllocateListNode();
  407.     p -> element = Sym(2);
  408.     p -> index = tail -> index + 1;
  409.  
  410.     p -> next = tail -> next;
  411.     tail -> next = p;
  412.  
  413.     Sym(1) = p;
  414. }
  415.  
  416. //
  417. // Rule 40:  TypeDeclarations ::= TypeDeclaration
  418. //
  419. #line 842 "java.g"
  420. //
  421. // Note that the list is circular so as to preserve the order of the elements
  422. //
  423. void Parser::Act40(void)
  424. {
  425.     AstListNode *p = AllocateListNode();
  426.     p -> next = p;
  427.     p -> element = Sym(1);
  428.     p -> index = 0;
  429.  
  430.     Sym(1) = p;
  431. }
  432.  
  433. //
  434. // Rule 41:  TypeDeclarations ::= TypeDeclarations TypeDeclaration
  435. //
  436. #line 859 "java.g"
  437. //
  438. // Note that the list is circular so as to preserve the order of the elements
  439. //
  440. void Parser::Act41(void)
  441. {
  442.     AstListNode *tail = (AstListNode *) Sym(1);
  443.  
  444.     AstListNode *p = AllocateListNode();
  445.     p -> element = Sym(2);
  446.     p -> index = tail -> index + 1;
  447.  
  448.     p -> next = tail -> next;
  449.     tail -> next = p;
  450.  
  451.     Sym(1) = p;
  452. }
  453.  
  454. //
  455. // Rule 42:  PackageDeclaration ::= package Name PackageHeaderMarker SEMICOLON
  456. //
  457. #line 880 "java.g"
  458. void Parser::Act42(void)
  459. {
  460.     AstPackageDeclaration *p = ast_pool -> NewPackageDeclaration();
  461.     p -> package_token   = Token(1);
  462.     p -> name            = (AstExpression *) Sym(2);
  463.     p -> semicolon_token = Token(3);
  464.     Sym(1) = p;
  465. }
  466.  
  467. //
  468. // Rule 43:  ImportDeclaration -> SingleTypeImportDeclaration
  469. //
  470. // void NoAction(void);
  471. //
  472.  
  473. //
  474. // Rule 44:  ImportDeclaration -> TypeImportOnDemandDeclaration
  475. //
  476. // void NoAction(void);
  477. //
  478.  
  479. //
  480. // Rule 45:  SingleTypeImportDeclaration ::= import Name SEMICOLON
  481. //
  482. #line 901 "java.g"
  483. void Parser::Act45(void)
  484. {
  485.     AstImportDeclaration *p = ast_pool -> NewImportDeclaration();
  486.     p -> import_token    = Token(1);
  487.     p -> name            = (AstExpression *) Sym(2);
  488.     p -> star_token_opt  = 0;
  489.     p -> semicolon_token = Token(3);
  490.     Sym(1) = p;
  491. }
  492.  
  493. //
  494. // Rule 46:  TypeImportOnDemandDeclaration ::= import Name DOT MULTIPLY SEMICOLON
  495. //
  496. #line 915 "java.g"
  497. void Parser::Act46(void)
  498. {
  499.     AstImportDeclaration *p = ast_pool -> NewImportDeclaration();
  500.     p -> import_token         = Token(1);
  501.     p -> name                 = (AstExpression *) Sym(2);
  502.     p -> star_token_opt       = Token(4);
  503.     p -> semicolon_token      = Token(5);
  504.     Sym(1) = p;
  505. }
  506.  
  507. //
  508. // Rule 47:  TypeDeclaration -> ClassDeclaration
  509. //
  510. // void NoAction(void);
  511. //
  512.  
  513. //
  514. // Rule 48:  TypeDeclaration -> InterfaceDeclaration
  515. //
  516. // void NoAction(void);
  517. //
  518.  
  519. //
  520. // Rule 49:  TypeDeclaration ::= SEMICOLON
  521. //
  522. #line 937 "java.g"
  523. void Parser::Act49(void)
  524. {
  525.     Sym(1) = ast_pool -> NewEmptyDeclaration(Token(1));
  526. }
  527.  
  528. //
  529. // Rule 50:  Modifiers ::= Modifier
  530. //
  531. #line 948 "java.g"
  532. //
  533. // Note that the list is circular so as to preserve the order of the elements
  534. //
  535. void Parser::Act50(void)
  536. {
  537.     AstListNode *p = AllocateListNode();
  538.     p -> next = p;
  539.     p -> element = Sym(1);
  540.     p -> index = 0;
  541.  
  542.     Sym(1) = p;
  543. }
  544.  
  545. //
  546. // Rule 51:  Modifiers ::= Modifiers Modifier
  547. //
  548. #line 965 "java.g"
  549. //
  550. // Note that the list is circular so as to preserve the order of the elements
  551. //
  552. void Parser::Act51(void)
  553. {
  554.     AstListNode *tail = (AstListNode *) Sym(1);
  555.  
  556.     AstListNode *p = AllocateListNode();
  557.     p -> element = Sym(2);
  558.     p -> index = tail -> index + 1;
  559.  
  560.     p -> next = tail -> next;
  561.     tail -> next = p;
  562.  
  563.     Sym(1) = p;
  564. }
  565.  
  566. //
  567. // Rule 52:  Modifier ::= public
  568. //
  569. #line 986 "java.g"
  570. void Parser::Act52(void)
  571. {
  572.     Sym(1) = ast_pool -> NewModifier(Ast::PUBLIC, Token(1));
  573. }
  574.  
  575. //
  576. // Rule 53:  Modifier ::= protected
  577. //
  578. #line 995 "java.g"
  579. void Parser::Act53(void)
  580. {
  581.     Sym(1) = ast_pool -> NewModifier(Ast::PROTECTED, Token(1));
  582. }
  583.  
  584. //
  585. // Rule 54:  Modifier ::= private
  586. //
  587. #line 1004 "java.g"
  588. void Parser::Act54(void)
  589. {
  590.     Sym(1) = ast_pool -> NewModifier(Ast::PRIVATE, Token(1));
  591. }
  592.  
  593. //
  594. // Rule 55:  Modifier ::= static
  595. //
  596. #line 1013 "java.g"
  597. void Parser::Act55(void)
  598. {
  599.     Sym(1) = ast_pool -> NewModifier(Ast::STATIC, Token(1));
  600. }
  601.  
  602. //
  603. // Rule 56:  Modifier ::= abstract
  604. //
  605. #line 1022 "java.g"
  606. void Parser::Act56(void)
  607. {
  608.     Sym(1) = ast_pool -> NewModifier(Ast::ABSTRACT, Token(1));
  609. }
  610.  
  611. //
  612. // Rule 57:  Modifier ::= final
  613. //
  614. #line 1031 "java.g"
  615. void Parser::Act57(void)
  616. {
  617.     Sym(1) = ast_pool -> NewModifier(Ast::FINAL, Token(1));
  618. }
  619.  
  620. //
  621. // Rule 58:  Modifier ::= native
  622. //
  623. #line 1040 "java.g"
  624. void Parser::Act58(void)
  625. {
  626.     Sym(1) = ast_pool -> NewModifier(Ast::NATIVE, Token(1));
  627. }
  628.  
  629. //
  630. // Rule 59:  Modifier ::= strictfp
  631. //
  632. #line 1049 "java.g"
  633. void Parser::Act59(void)
  634. {
  635.     Sym(1) = ast_pool -> NewModifier(Ast::STRICTFP, Token(1));
  636. }
  637.  
  638. //
  639. // Rule 60:  Modifier ::= synchronized
  640. //
  641. #line 1058 "java.g"
  642. void Parser::Act60(void)
  643. {
  644.     Sym(1) = ast_pool -> NewModifier(Ast::SYNCHRONIZED, Token(1));
  645. }
  646.  
  647. //
  648. // Rule 61:  Modifier ::= transient
  649. //
  650. #line 1067 "java.g"
  651. void Parser::Act61(void)
  652. {
  653.     Sym(1) = ast_pool -> NewModifier(Ast::TRANSIENT, Token(1));
  654. }
  655.  
  656. //
  657. // Rule 62:  Modifier ::= volatile
  658. //
  659. #line 1076 "java.g"
  660. void Parser::Act62(void)
  661. {
  662.     Sym(1) = ast_pool -> NewModifier(Ast::VOLATILE, Token(1));
  663. }
  664.  
  665. //
  666. // Rule 63:  ClassDeclaration ::= Modifiersopt class Identifier Superopt Interfacesopt ClassBody
  667. //
  668. #line 1092 "java.g"
  669. void Parser::Act63(void)
  670. {
  671.     AstClassDeclaration *p = ast_pool -> NewClassDeclaration();
  672.     if (Sym(1) != NULL)
  673.     {
  674.         AstListNode *tail = (AstListNode *) Sym(1);
  675.         p -> AllocateClassModifiers(tail -> index + 1);
  676.         AstListNode *root = tail;
  677.         do
  678.         {
  679.             root = root -> next;
  680.             p -> AddClassModifier((AstModifier *) root -> element);
  681.         } while(root != tail);
  682.         FreeCircularList(tail);
  683.     }
  684.     p -> class_token          = Token(2);
  685.     p -> identifier_token     = Token(3);
  686.     p -> super_opt            = (AstExpression *) Sym(4);
  687.     if (Sym(5) != NULL)
  688.     {
  689.         AstListNode *tail = (AstListNode *) Sym(5);
  690.         p -> AllocateInterfaces(tail -> index + 1);
  691.         AstListNode *root = tail;
  692.         do
  693.         {
  694.             root = root -> next;
  695.             p -> AddInterface((AstExpression *) root -> element);
  696.         } while(root != tail);
  697.         FreeCircularList(tail);
  698.     }
  699.     p -> class_body = (AstClassBody *) Sym(6);
  700.     Sym(1) = p;
  701. }
  702.  
  703. //
  704. // Rule 64:  Super ::= extends ClassType
  705. //
  706. #line 1130 "java.g"
  707. void Parser::SetSym1ToSym2(void) { Sym(1) = Sym(2); }
  708.  
  709. //
  710. // Rule 65:  Interfaces ::= implements InterfaceTypeList
  711. //
  712. // void SetSym1ToSym2(void);
  713. //
  714.  
  715. //
  716. // Rule 66:  InterfaceTypeList ::= InterfaceType
  717. //
  718. #line 1143 "java.g"
  719. //
  720. // Note that the list is circular so as to preserve the order of the elements
  721. //
  722. void Parser::Act66(void)
  723. {
  724.     AstListNode *p = AllocateListNode();
  725.     p -> next = p;
  726.     p -> element = Sym(1);
  727.     p -> index = 0;
  728.  
  729.     Sym(1) = p;
  730. }
  731.  
  732. //
  733. // Rule 67:  InterfaceTypeList ::= InterfaceTypeList COMMA InterfaceType
  734. //
  735. #line 1160 "java.g"
  736. //
  737. // Note that the list is circular so as to preserve the order of the elements
  738. //
  739. void Parser::Act67(void)
  740. {
  741.     AstListNode *tail = (AstListNode *) Sym(1);
  742.  
  743.     AstListNode *p = AllocateListNode();
  744.     p -> element = Sym(3);
  745.     p -> index = tail -> index + 1;
  746.  
  747.     p -> next = tail -> next;
  748.     tail -> next = p;
  749.  
  750.     Sym(1) = p;
  751. }
  752.  
  753. //
  754. // Rule 68:  ClassBody ::= LBRACE ClassBodyDeclarationsopt RBRACE
  755. //
  756. #line 1181 "java.g"
  757. void Parser::Act68(void)
  758. {
  759.     AstClassBody *p = ast_pool -> NewClassBody();
  760.     if (parse_header_only)
  761.         p -> mark_unparsed();
  762.  
  763.     p -> left_brace_token = Token(1);
  764.     if (Sym(2) != NULL)
  765.     {
  766.         int num_instance_variables = 0,
  767.             num_class_variables = 0,
  768.             num_methods = 0,
  769.             num_constructors = 0,
  770.             num_static_initializers = 0,
  771.             num_inner_classes = 0,
  772.             num_inner_interfaces = 0,
  773.             num_blocks = 0,
  774.             num_empty_declarations = 0;
  775.  
  776.         AstListNode *tail = (AstListNode *) Sym(2);
  777.         p -> AllocateClassBodyDeclarations(tail -> index + 1);
  778.         AstListNode *root = tail;
  779.         do
  780.         {
  781.             root = root -> next;
  782.             p -> AddClassBodyDeclaration(root -> element);
  783.  
  784.             AstFieldDeclaration *field_declaration = root -> element -> FieldDeclarationCast();
  785.             if (field_declaration)
  786.             {
  787.                 for (int i = 0; i < field_declaration -> NumVariableModifiers(); i++)
  788.                 {
  789.                     if (field_declaration -> VariableModifier(i) -> kind == Ast::STATIC)
  790.                     {
  791.                         field_declaration -> MarkStatic();
  792.                         break;
  793.                     }
  794.                 }
  795.                 if (field_declaration -> StaticFieldCast())
  796.                      num_class_variables++;
  797.                 else num_instance_variables++;
  798.             }
  799.             else if (root -> element -> MethodDeclarationCast())
  800.             {
  801.                 num_methods++;
  802.             }
  803.             else if (root -> element -> ConstructorDeclarationCast())
  804.             {
  805.                 num_constructors++;
  806.             }
  807.             else if (root -> element -> StaticInitializerCast())
  808.             {
  809.                 num_static_initializers++;
  810.             }
  811.             else if (root -> element -> ClassDeclarationCast())
  812.             {
  813.                 num_inner_classes++;
  814.             }
  815.             else if (root -> element -> InterfaceDeclarationCast())
  816.             {
  817.                 num_inner_interfaces++;
  818.             }
  819.             else if (root -> element -> BlockCast())
  820.             {
  821.                 num_blocks++;
  822.             }
  823.             else num_empty_declarations++;
  824.         } while(root != tail);
  825.  
  826.         p -> AllocateInstanceVariables(num_instance_variables);
  827.         p -> AllocateClassVariables(num_class_variables);
  828.         p -> AllocateMethods(num_methods);
  829.         p -> AllocateConstructors(num_constructors);
  830.         p -> AllocateStaticInitializers(num_static_initializers);
  831.         p -> AllocateNestedClasses(num_inner_classes);
  832.         p -> AllocateNestedInterfaces(num_inner_interfaces);
  833.         p -> AllocateBlocks(num_blocks);
  834.         p -> AllocateEmptyDeclarations(num_empty_declarations);
  835.  
  836.         root = tail;
  837.         do
  838.         {
  839.             root = root -> next;
  840.  
  841.             AstFieldDeclaration *field_declaration;
  842.             AstMethodDeclaration *method_declaration;
  843.             AstConstructorDeclaration *constructor_declaration;
  844.             AstStaticInitializer *static_initializer;
  845.             AstClassDeclaration *class_declaration;
  846.             AstInterfaceDeclaration *interface_declaration;
  847.             AstBlock *block;
  848.  
  849.             if ((field_declaration = root -> element -> FieldDeclarationCast()))
  850.             {
  851.                 if (field_declaration -> StaticFieldCast())
  852.                      p -> AddClassVariable(field_declaration);
  853.                 else p -> AddInstanceVariable(field_declaration);
  854.             }
  855.             else if ((method_declaration = root -> element -> MethodDeclarationCast()))
  856.             {
  857.                 p -> AddMethod(method_declaration);
  858.             }
  859.             else if ((constructor_declaration = root -> element -> ConstructorDeclarationCast()))
  860.             {
  861.                 p -> AddConstructor(constructor_declaration);
  862.             }
  863.             else if ((static_initializer = root -> element -> StaticInitializerCast()))
  864.             {
  865.                 p -> AddStaticInitializer(static_initializer);
  866.             }
  867.             else if ((class_declaration = root -> element -> ClassDeclarationCast()))
  868.             {
  869.                 p -> AddNestedClass(class_declaration);
  870.             }
  871.             else if ((interface_declaration = root -> element -> InterfaceDeclarationCast()))
  872.             {
  873.                 p -> AddNestedInterface(interface_declaration);
  874.             }
  875.             else if ((block = root -> element -> BlockCast()))
  876.             {
  877.                 p -> AddBlock(block);
  878.             }
  879.             else // assert(block = root -> element -> EmptyDeclarationCast())
  880.             {
  881.                 p -> AddEmptyDeclaration((AstEmptyDeclaration *) root -> element);
  882.             }
  883.         } while(root != tail);
  884.         FreeCircularList(tail);
  885.     }
  886.     p -> right_brace_token = Token(3);
  887.     p -> pool = body_pool; // from now on, this is the storage pool to use for this type
  888.     Sym(1) = p;
  889. }
  890.  
  891. //
  892. // Rule 69:  ClassBodyDeclarations ::= ClassBodyDeclaration
  893. //
  894. #line 1319 "java.g"
  895. //
  896. // Note that the list is circular so as to preserve the order of the elements
  897. //
  898. void Parser::Act69(void)
  899. {
  900.     AstListNode *p = AllocateListNode();
  901.     p -> next = p;
  902.     p -> element = Sym(1);
  903.     p -> index = 0;
  904.  
  905.     Sym(1) = p;
  906. }
  907.  
  908. //
  909. // Rule 70:  ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration
  910. //
  911. #line 1336 "java.g"
  912. //
  913. // Note that the list is circular so as to preserve the order of the elements
  914. //
  915. void Parser::Act70(void)
  916. {
  917.     AstListNode *tail = (AstListNode *) Sym(1);
  918.  
  919.     AstListNode *p = AllocateListNode();
  920.     p -> element = Sym(2);
  921.     p -> index = tail -> index + 1;
  922.  
  923.     p -> next = tail -> next;
  924.     tail -> next = p;
  925.  
  926.     Sym(1) = p;
  927. }
  928.  
  929. //
  930. // Rule 71:  ClassBodyDeclaration -> ClassMemberDeclaration
  931. //
  932. // void NoAction(void);
  933. //
  934.  
  935. //
  936. // Rule 72:  ClassBodyDeclaration -> StaticInitializer
  937. //
  938. // void NoAction(void);
  939. //
  940.  
  941. //
  942. // Rule 73:  ClassBodyDeclaration -> ConstructorDeclaration
  943. //
  944. // void NoAction(void);
  945. //
  946.  
  947. //
  948. // Rule 74:  ClassBodyDeclaration ::= MethodHeaderMarker Block
  949. //
  950. #line 1370 "java.g"
  951. void Parser::Act74(void)
  952. {
  953.     Sym(1) = Sym(2);
  954. }
  955.  
  956. //
  957. // Rule 75:  ClassMemberDeclaration -> FieldDeclaration
  958. //
  959. // void NoAction(void);
  960. //
  961.  
  962. //
  963. // Rule 76:  ClassMemberDeclaration -> MethodDeclaration
  964. //
  965. // void NoAction(void);
  966. //
  967.  
  968. //
  969. // Rule 77:  ClassMemberDeclaration -> ClassDeclaration
  970. //
  971. // void NoAction(void);
  972. //
  973.  
  974. //
  975. // Rule 78:  ClassMemberDeclaration -> InterfaceDeclaration
  976. //
  977. // void NoAction(void);
  978. //
  979.  
  980. //
  981. // Rule 79:  ClassMemberDeclaration ::= SEMICOLON
  982. //
  983. #line 1404 "java.g"
  984. void Parser::Act79(void)
  985. {
  986.     Sym(1) = ast_pool -> NewEmptyDeclaration(Token(1));
  987. }
  988.  
  989. //
  990. // Rule 80:  FieldDeclaration ::= Modifiersopt Type VariableDeclarators SEMICOLON
  991. //
  992. #line 1423 "java.g"
  993. void Parser::Act80(void)
  994. {
  995.     AstFieldDeclaration *p = ast_pool -> NewFieldDeclaration();
  996.     if (Sym(1) != NULL)
  997.     {
  998.         AstListNode *tail = (AstListNode *) Sym(1);
  999.         p -> AllocateVariableModifiers(tail -> index + 1);
  1000.         AstListNode *root = tail;
  1001.         do
  1002.         {
  1003.             root = root -> next;
  1004.             p -> AddVariableModifier((AstModifier *) root -> element);
  1005.         } while(root != tail);
  1006.         FreeCircularList(tail);
  1007.     }
  1008.     p -> type = Sym(2);
  1009.     //
  1010.     // The list of declarators is guaranteed not empty
  1011.     //
  1012.     {
  1013.         AstListNode *tail = (AstListNode *) Sym(3);
  1014.         p -> AllocateVariableDeclarators(tail -> index + 1);
  1015.         AstListNode *root = tail;
  1016.         do
  1017.         {
  1018.             root = root -> next;
  1019.             p -> AddVariableDeclarator((AstVariableDeclarator *) root -> element);
  1020.         } while(root != tail);
  1021.         FreeCircularList(tail);
  1022.     }
  1023.     p -> semicolon_token      = Token(4);
  1024.     Sym(1) = p;
  1025. }
  1026.  
  1027. //
  1028. // Rule 81:  VariableDeclarators ::= VariableDeclarator
  1029. //
  1030. #line 1461 "java.g"
  1031. //
  1032. // Note that the list is circular so as to preserve the order of the elements
  1033. //
  1034. void Parser::Act81(void)
  1035. {
  1036.     AstListNode *p = AllocateListNode();
  1037.     p -> next = p;
  1038.     p -> element = Sym(1);
  1039.     p -> index = 0;
  1040.  
  1041.     Sym(1) = p;
  1042. }
  1043.  
  1044. //
  1045. // Rule 82:  VariableDeclarators ::= VariableDeclarators COMMA VariableDeclarator
  1046. //
  1047. #line 1478 "java.g"
  1048. //
  1049. // Note that the list is circular so as to preserve the order of the elements
  1050. //
  1051. void Parser::Act82(void)
  1052. {
  1053.     AstListNode *tail = (AstListNode *) Sym(1);
  1054.  
  1055.     AstListNode *p = AllocateListNode();
  1056.     p -> element = Sym(3);
  1057.     p -> index = tail -> index + 1;
  1058.  
  1059.     p -> next = tail -> next;
  1060.     tail -> next = p;
  1061.  
  1062.     Sym(1) = p;
  1063. }
  1064.  
  1065. //
  1066. // Rule 83:  VariableDeclarator ::= VariableDeclaratorId
  1067. //
  1068. #line 1499 "java.g"
  1069. void Parser::Act83(void)
  1070. {
  1071.     AstVariableDeclarator *p = ast_pool -> NewVariableDeclarator();
  1072.     p -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(1);
  1073.     p -> variable_initializer_opt = NULL;
  1074.     Sym(1) = p;
  1075. }
  1076.  
  1077. //
  1078. // Rule 84:  VariableDeclarator ::= VariableDeclaratorId EQUAL VariableInitializer
  1079. //
  1080. #line 1511 "java.g"
  1081. void Parser::Act84(void)
  1082. {
  1083.     AstVariableDeclarator *p = ast_pool -> NewVariableDeclarator();
  1084.     p -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(1);
  1085.     p -> variable_initializer_opt = Sym(3);
  1086.     Sym(1) = p;
  1087. }
  1088.  
  1089. //
  1090. // Rule 85:  VariableDeclaratorId ::= Identifier Dimsopt
  1091. //
  1092. #line 1523 "java.g"
  1093. void Parser::Act85(void)
  1094. {
  1095.     AstVariableDeclaratorId *p = ast_pool -> NewVariableDeclaratorId();
  1096.     p -> identifier_token = Token(1);
  1097.     if (Sym(2) != NULL)
  1098.     {
  1099.         AstListNode *tail = (AstListNode *) Sym(2);
  1100.         p -> AllocateBrackets(tail -> index + 1);
  1101.         AstListNode *root = tail;
  1102.         do
  1103.         {
  1104.             root = root -> next;
  1105.             p -> AddBrackets((AstBrackets *) root -> element);
  1106.         } while(root != tail);
  1107.         FreeCircularList(tail);
  1108.     }
  1109.     Sym(1) = p;
  1110. }
  1111.  
  1112. //
  1113. // Rule 86:  VariableInitializer -> Expression
  1114. //
  1115. // void NoAction(void);
  1116. //
  1117.  
  1118. //
  1119. // Rule 87:  VariableInitializer -> ArrayInitializer
  1120. //
  1121. // void NoAction(void);
  1122. //
  1123.  
  1124. //
  1125. // Rule 88:  MethodDeclaration ::= MethodHeader MethodHeaderMarker MethodBody
  1126. //
  1127. #line 1571 "java.g"
  1128. void Parser::Act88(void)
  1129. {
  1130.     ((AstMethodDeclaration *) Sym(1)) -> method_body = (AstStatement *) Sym(3);
  1131. }
  1132.  
  1133. //
  1134. // Rule 89:  MethodHeader ::= Modifiersopt Type MethodDeclarator Throwsopt
  1135. //
  1136. #line 1580 "java.g"
  1137. void Parser::Act89(void)
  1138. {
  1139.     AstMethodDeclaration *p = ast_pool -> NewMethodDeclaration();
  1140.     if (Sym(1) != NULL)
  1141.     {
  1142.         AstListNode *tail = (AstListNode *) Sym(1);
  1143.         p -> AllocateMethodModifiers(tail -> index + 1);
  1144.         AstListNode *root = tail;
  1145.         do
  1146.         {
  1147.             root = root -> next;
  1148.             p -> AddMethodModifier((AstModifier *) root -> element);
  1149.         } while(root != tail);
  1150.         FreeCircularList(tail);
  1151.     }
  1152.     p -> type              = Sym(2);
  1153.     p -> method_declarator = (AstMethodDeclarator *) Sym(3);
  1154.     if (Sym(4) != NULL)
  1155.     {
  1156.         AstListNode *tail = (AstListNode *) Sym(4);
  1157.         p -> AllocateThrows(tail -> index + 1);
  1158.         AstListNode *root = tail;
  1159.         do
  1160.         {
  1161.             root = root -> next;
  1162.             p -> AddThrow((AstExpression *) root -> element);
  1163.         } while(root != tail);
  1164.         FreeCircularList(tail);
  1165.     }
  1166.     Sym(1) = p;
  1167. }
  1168.  
  1169. //
  1170. // Rule 90:  MethodHeader ::= Modifiersopt void MethodDeclarator Throwsopt
  1171. //
  1172. #line 1616 "java.g"
  1173. void Parser::Act90(void)
  1174. {
  1175.     AstMethodDeclaration *p = ast_pool -> NewMethodDeclaration();
  1176.     if (Sym(1) != NULL)
  1177.     {
  1178.         AstListNode *tail = (AstListNode *) Sym(1);
  1179.         p -> AllocateMethodModifiers(tail -> index + 1);
  1180.         AstListNode *root = tail;
  1181.         do
  1182.         {
  1183.             root = root -> next;
  1184.             p -> AddMethodModifier((AstModifier *) root -> element);
  1185.         } while(root != tail);
  1186.         FreeCircularList(tail);
  1187.     }
  1188.     p -> type              = ast_pool -> NewPrimitiveType(Ast::VOID_TYPE, Token(2));
  1189.     p -> method_declarator = (AstMethodDeclarator *) Sym(3);
  1190.     if (Sym(4) != NULL)
  1191.     {
  1192.         AstListNode *tail = (AstListNode *) Sym(4);
  1193.         p -> AllocateThrows(tail -> index + 1);
  1194.         AstListNode *root = tail;
  1195.         do
  1196.         {
  1197.             root = root -> next;
  1198.             p -> AddThrow((AstExpression *) root -> element);
  1199.         } while(root != tail);
  1200.         FreeCircularList(tail);
  1201.     }
  1202.     Sym(1) = p;
  1203. }
  1204.  
  1205. //
  1206. // Rule 91:  MethodDeclarator ::= Identifier LPAREN FormalParameterListopt RPAREN Dimsopt
  1207. //
  1208. #line 1652 "java.g"
  1209. void Parser::Act91(void)
  1210. {
  1211.     AstMethodDeclarator *p = ast_pool -> NewMethodDeclarator();
  1212.     p -> identifier_token        = Token(1);
  1213.     p -> left_parenthesis_token  = Token(2);
  1214.     if (Sym(3) != NULL)
  1215.     {
  1216.         AstListNode *tail = (AstListNode *) Sym(3);
  1217.         p -> AllocateFormalParameters(tail -> index + 1);
  1218.         AstListNode *root = tail;
  1219.         do
  1220.         {
  1221.             root = root -> next;
  1222.             p -> AddFormalParameter((AstFormalParameter *) root -> element);
  1223.         } while(root != tail);
  1224.         FreeCircularList(tail);
  1225.     }
  1226.     p -> right_parenthesis_token = Token(4);
  1227.     if (Sym(5) != NULL)
  1228.     {
  1229.         AstListNode *tail = (AstListNode *) Sym(5);
  1230.         p -> AllocateBrackets(tail -> index + 1);
  1231.         AstListNode *root = tail;
  1232.         do
  1233.         {
  1234.             root = root -> next;
  1235.             p -> AddBrackets((AstBrackets *) root -> element);
  1236.         } while(root != tail);
  1237.         FreeCircularList(tail);
  1238.     }
  1239.     Sym(1) = p;
  1240. }
  1241.  
  1242. //
  1243. // Rule 92:  FormalParameterList ::= FormalParameter
  1244. //
  1245. #line 1689 "java.g"
  1246. //
  1247. // Note that the list is circular so as to preserve the order of the elements
  1248. //
  1249. void Parser::Act92(void)
  1250. {
  1251.     AstListNode *p = AllocateListNode();
  1252.     p -> next = p;
  1253.     p -> element = Sym(1);
  1254.     p -> index = 0;
  1255.  
  1256.     Sym(1) = p;
  1257. }
  1258.  
  1259. //
  1260. // Rule 93:  FormalParameterList ::= FormalParameterList COMMA FormalParameter
  1261. //
  1262. #line 1706 "java.g"
  1263. //
  1264. // Note that the list is circular so as to preserve the order of the elements
  1265. //
  1266. void Parser::Act93(void)
  1267. {
  1268.     AstListNode *tail = (AstListNode *) Sym(1);
  1269.  
  1270.     AstListNode *p = AllocateListNode();
  1271.     p -> element = Sym(3);
  1272.     p -> index = tail -> index + 1;
  1273.  
  1274.     p -> next = tail -> next;
  1275.     tail -> next = p;
  1276.  
  1277.     Sym(1) = p;
  1278. }
  1279.  
  1280. //
  1281. // Rule 94:  FormalParameter ::= Type VariableDeclaratorId
  1282. //
  1283. #line 1727 "java.g"
  1284. void Parser::Act94(void)
  1285. {
  1286.     AstFormalParameter *p = ast_pool -> NewFormalParameter();
  1287.     p -> type = Sym(1);
  1288.  
  1289.     AstVariableDeclarator *formal_declarator = ast_pool -> NewVariableDeclarator();
  1290.     formal_declarator -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(2);
  1291.     formal_declarator -> variable_initializer_opt = NULL;
  1292.  
  1293.     p -> formal_declarator = formal_declarator;
  1294.  
  1295.     Sym(1) = p;
  1296. }
  1297.  
  1298. //
  1299. // Rule 95:  FormalParameter ::= Modifiers Type VariableDeclaratorId
  1300. //
  1301. #line 1746 "java.g"
  1302. void Parser::Act95(void)
  1303. {
  1304.     AstFormalParameter *p = ast_pool -> NewFormalParameter();
  1305.     //
  1306.     // The list of modifiers is guaranteed not empty
  1307.     //
  1308.     {
  1309.         AstListNode *tail = (AstListNode *) Sym(1);
  1310.         p -> AllocateParameterModifiers(tail -> index + 1);
  1311.         AstListNode *root = tail;
  1312.         do
  1313.         {
  1314.             root = root -> next;
  1315.             p -> AddParameterModifier((AstModifier *) root -> element);
  1316.         } while(root != tail);
  1317.         FreeCircularList(tail);
  1318.     }
  1319.  
  1320.     p -> type = Sym(2);
  1321.  
  1322.     AstVariableDeclarator *formal_declarator = ast_pool -> NewVariableDeclarator();
  1323.     formal_declarator -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(3);
  1324.     formal_declarator -> variable_initializer_opt = NULL;
  1325.  
  1326.     p -> formal_declarator = formal_declarator;
  1327.  
  1328.     Sym(1) = p;
  1329. }
  1330.  
  1331. //
  1332. // Rule 96:  Throws ::= throws ClassTypeList
  1333. //
  1334. // void SetSym1ToSym2(void);
  1335. //
  1336.  
  1337. //
  1338. // Rule 97:  ClassTypeList ::= ClassType
  1339. //
  1340. #line 1786 "java.g"
  1341. //
  1342. // Note that the list is circular so as to preserve the order of the elements
  1343. //
  1344. void Parser::Act97(void)
  1345. {
  1346.     AstListNode *p = AllocateListNode();
  1347.     p -> next = p;
  1348.     p -> element = Sym(1);
  1349.     p -> index = 0;
  1350.  
  1351.     Sym(1) = p;
  1352. }
  1353.  
  1354. //
  1355. // Rule 98:  ClassTypeList ::= ClassTypeList COMMA ClassType
  1356. //
  1357. #line 1803 "java.g"
  1358. //
  1359. // Note that the list is circular so as to preserve the order of the elements
  1360. //
  1361. void Parser::Act98(void)
  1362. {
  1363.     AstListNode *tail = (AstListNode *) Sym(1);
  1364.  
  1365.     AstListNode *p = AllocateListNode();
  1366.     p -> element = Sym(3);
  1367.     p -> index = tail -> index + 1;
  1368.  
  1369.     p -> next = tail -> next;
  1370.     tail -> next = p;
  1371.  
  1372.     Sym(1) = p;
  1373. }
  1374.  
  1375. //
  1376. // Rule 99:  MethodBody -> Block
  1377. //
  1378. // void NoAction(void);
  1379. //
  1380.  
  1381. //
  1382. // Rule 100:  MethodBody ::= SEMICOLON
  1383. //
  1384. #line 1828 "java.g"
  1385. void Parser::MakeEmptyStatement(void)
  1386. {
  1387.     Sym(1) = ast_pool -> NewEmptyStatement(Token(1));
  1388. }
  1389.  
  1390. //
  1391. // Rule 101:  StaticInitializer ::= static MethodHeaderMarker Block
  1392. //
  1393. #line 1839 "java.g"
  1394. void Parser::Act101(void)
  1395. {
  1396.     AstStaticInitializer *p = ast_pool -> NewStaticInitializer();
  1397.     p -> static_token = Token(1);
  1398.     p -> block        = (AstBlock *) Sym(3);
  1399.     Sym(1) = p;
  1400. }
  1401.  
  1402. //
  1403. // Rule 102:  ConstructorDeclaration ::= Modifiersopt ConstructorDeclarator Throwsopt MethodHeaderMarker ConstructorBody
  1404. //
  1405. #line 1864 "java.g"
  1406. void Parser::Act102(void)
  1407. {
  1408.     AstConstructorBlock *block = Sym(5) -> ConstructorBlockCast();
  1409.     if (! block)
  1410.     {
  1411.         block = ast_pool -> NewConstructorBlock();
  1412.         block -> left_brace_token                    = Sym(5) -> LeftToken();
  1413.         block -> explicit_constructor_invocation_opt = NULL;
  1414.         block -> block                               = (AstBlock *) Sym(5);
  1415.         block -> right_brace_token                   = Sym(5) -> RightToken();
  1416.     }
  1417.  
  1418.     AstConstructorDeclaration *p = ast_pool -> NewConstructorDeclaration();
  1419.  
  1420.     if (Sym(1) != NULL)
  1421.     {
  1422.         AstListNode *tail = (AstListNode *) Sym(1);
  1423.         p -> AllocateConstructorModifiers(tail -> index + 1);
  1424.         AstListNode *root = tail;
  1425.         do
  1426.         {
  1427.             root = root -> next;
  1428.             p -> AddConstructorModifier((AstModifier *) root -> element);
  1429.         } while(root != tail);
  1430.         FreeCircularList(tail);
  1431.     }
  1432.     p -> constructor_declarator = (AstMethodDeclarator *) Sym(2);
  1433.     if (Sym(3) != NULL)
  1434.     {
  1435.         AstListNode *tail = (AstListNode *) Sym(3);
  1436.         p -> AllocateThrows(tail -> index + 1);
  1437.         AstListNode *root = tail;
  1438.         do
  1439.         {
  1440.             root = root -> next;
  1441.             p -> AddThrow((AstExpression *) root -> element);
  1442.         } while(root != tail);
  1443.         FreeCircularList(tail);
  1444.     }
  1445.     p -> constructor_body       = block;
  1446.  
  1447.     Sym(1) = p;
  1448. }
  1449.  
  1450. //
  1451. // Rule 103:  ConstructorDeclarator ::= Identifier LPAREN FormalParameterListopt RPAREN
  1452. //
  1453. #line 1920 "java.g"
  1454. void Parser::Act103(void)
  1455. {
  1456.     AstMethodDeclarator *p = ast_pool -> NewMethodDeclarator();
  1457.     p -> identifier_token        = Token(1);
  1458.     p -> left_parenthesis_token  = Token(2);
  1459.     if (Sym(3) != NULL)
  1460.     {
  1461.         AstListNode *tail = (AstListNode *) Sym(3);
  1462.         p -> AllocateFormalParameters(tail -> index + 1);
  1463.         AstListNode *root = tail;
  1464.         do
  1465.         {
  1466.             root = root -> next;
  1467.             p -> AddFormalParameter((AstFormalParameter *) root -> element);
  1468.         } while(root != tail);
  1469.         FreeCircularList(tail);
  1470.     }
  1471.     p -> right_parenthesis_token = Token(4);
  1472.     Sym(1) = p;
  1473. }
  1474.  
  1475. //
  1476. // Rule 104:  ConstructorBody -> Block
  1477. //
  1478. // void NoAction(void);
  1479. //
  1480.  
  1481. //
  1482. // Rule 105:  ConstructorBody ::= LBRACE ExplicitConstructorInvocation BlockStatementsopt RBRACE
  1483. //
  1484. #line 1955 "java.g"
  1485. void Parser::Act105(void)
  1486. {
  1487.     AstBlock *block = ast_pool -> NewBlock();
  1488.     if (Sym(3) != NULL)
  1489.     {
  1490.         AstListNode *tail = (AstListNode *) Sym(3);
  1491.         block -> AllocateBlockStatements(tail -> index + 1);
  1492.         AstListNode *root = tail;
  1493.         block -> left_brace_token  = root -> element -> LeftToken();
  1494.         block -> right_brace_token = tail -> element -> RightToken();
  1495.         do
  1496.         {
  1497.             root = root -> next;
  1498.             block -> AddStatement((AstStatement *) root -> element);
  1499.         } while(root != tail);
  1500.         FreeCircularList(tail);
  1501.     }
  1502.     else
  1503.     {
  1504.         block -> left_brace_token  = Token(4);
  1505.         block -> right_brace_token = Token(4);
  1506.     }
  1507.  
  1508.     AstConstructorBlock *p = ast_pool -> NewConstructorBlock();
  1509.     p -> left_brace_token                    = Token(1);
  1510.     p -> explicit_constructor_invocation_opt = Sym(2);
  1511.     p -> block                               = block;
  1512.     p -> right_brace_token                   = Token(4);
  1513.     Sym(1) = p;
  1514. }
  1515.  
  1516. //
  1517. // Rule 106:  ExplicitConstructorInvocation ::= this LPAREN ArgumentListopt RPAREN SEMICOLON
  1518. //
  1519. #line 1990 "java.g"
  1520. void Parser::Act106(void)
  1521. {
  1522.     AstThisCall *p = ast_pool -> NewThisCall();
  1523.     p -> base_opt                = NULL;
  1524.     p -> dot_token_opt           = 0;
  1525.     p -> this_token              = Token(1);
  1526.     p -> left_parenthesis_token  = Token(2);
  1527.     if (Sym(3) != NULL)
  1528.     {
  1529.         AstListNode *tail = (AstListNode *) Sym(3);
  1530.         p -> AllocateArguments(tail -> index + 1);
  1531.         AstListNode *root = tail;
  1532.         do
  1533.         {
  1534.             root = root -> next;
  1535.             p -> AddArgument((AstExpression *) root -> element);
  1536.         } while(root != tail);
  1537.         FreeCircularList(tail);
  1538.     }
  1539.     p -> right_parenthesis_token = Token(4);
  1540.     p -> semicolon_token         = Token(5);
  1541.     Sym(1) = p;
  1542. }
  1543.  
  1544. //
  1545. // Rule 107:  ExplicitConstructorInvocation ::= super LPAREN ArgumentListopt RPAREN SEMICOLON
  1546. //
  1547. #line 2018 "java.g"
  1548. void Parser::Act107(void)
  1549. {
  1550.     AstSuperCall *p = ast_pool -> NewSuperCall();
  1551.     p -> base_opt                = NULL;
  1552.     p -> dot_token_opt           = 0;
  1553.     p -> super_token             = Token(1);
  1554.     p -> left_parenthesis_token  = Token(2);
  1555.     if (Sym(3) != NULL)
  1556.     {
  1557.         AstListNode *tail = (AstListNode *) Sym(3);
  1558.         p -> AllocateArguments(tail -> index + 1);
  1559.         AstListNode *root = tail;
  1560.         do
  1561.         {
  1562.             root = root -> next;
  1563.             p -> AddArgument((AstExpression *) root -> element);
  1564.         } while(root != tail);
  1565.         FreeCircularList(tail);
  1566.     }
  1567.     p -> right_parenthesis_token = Token(4);
  1568.     p -> semicolon_token         = Token(5);
  1569.     Sym(1) = p;
  1570. }
  1571.  
  1572. //
  1573. // Rule 108:  ExplicitConstructorInvocation ::= Primary DOT this LPAREN ArgumentListopt RPAREN SEMICOLON
  1574. //
  1575. #line 2047 "java.g"
  1576. void Parser::Act108(void)
  1577. {
  1578.     AstThisCall *p = ast_pool -> NewThisCall();
  1579.     p -> base_opt               = (AstExpression *) Sym(1);
  1580.     p -> dot_token_opt          = Token(2);
  1581.     p -> this_token             = Token(3);
  1582.     p -> left_parenthesis_token = Token(4);
  1583.     if (Sym(5) != NULL)
  1584.     {
  1585.         AstListNode *tail = (AstListNode *) Sym(5);
  1586.         p -> AllocateArguments(tail -> index + 1);
  1587.         AstListNode *root = tail;
  1588.         do
  1589.         {
  1590.             root = root -> next;
  1591.             p -> AddArgument((AstExpression *) root -> element);
  1592.         } while(root != tail);
  1593.         FreeCircularList(tail);
  1594.     }
  1595.     p -> right_parenthesis_token = Token(6);
  1596.     p -> semicolon_token         = Token(7);
  1597.     Sym(1) = p;
  1598. }
  1599.  
  1600. //
  1601. // Rule 109:  ExplicitConstructorInvocation ::= Primary DOT super LPAREN ArgumentListopt RPAREN SEMICOLON
  1602. //
  1603. #line 2076 "java.g"
  1604. void Parser::MakeQualifiedSuper(void)
  1605. {
  1606.     AstSuperCall *p = ast_pool -> NewSuperCall();
  1607.     p -> base_opt                = (AstExpression *) Sym(1);
  1608.     p -> dot_token_opt           = Token(2);
  1609.     p -> super_token             = Token(3);
  1610.     p -> left_parenthesis_token  = Token(4);
  1611.     if (Sym(5) != NULL)
  1612.     {
  1613.         AstListNode *tail = (AstListNode *) Sym(5);
  1614.         p -> AllocateArguments(tail -> index + 1);
  1615.         AstListNode *root = tail;
  1616.         do
  1617.         {
  1618.             root = root -> next;
  1619.             p -> AddArgument((AstExpression *) root -> element);
  1620.         } while(root != tail);
  1621.         FreeCircularList(tail);
  1622.     }
  1623.     p -> right_parenthesis_token = Token(6);
  1624.     p -> semicolon_token         = Token(7);
  1625.     Sym(1) = p;
  1626. }
  1627.  
  1628. //
  1629. // Rule 110:  ExplicitConstructorInvocation ::= Name DOT super LPAREN ArgumentListopt RPAREN SEMICOLON
  1630. //
  1631. // void MakeQualifiedSuper(void);
  1632. //
  1633.  
  1634. //
  1635. // Rule 111:  InterfaceDeclaration ::= Modifiersopt interface Identifier ExtendsInterfacesopt InterfaceBody
  1636. //
  1637. #line 2119 "java.g"
  1638. void Parser::Act111(void)
  1639. {
  1640.     AstInterfaceDeclaration *p = (AstInterfaceDeclaration *) Sym(5);
  1641.     if (Sym(1) != NULL)
  1642.     {
  1643.         AstListNode *tail = (AstListNode *) Sym(1);
  1644.         p -> AllocateInterfaceModifiers(tail -> index + 1);
  1645.         AstListNode *root = tail;
  1646.         do
  1647.         {
  1648.             root = root -> next;
  1649.             p -> AddInterfaceModifier((AstModifier *) root -> element);
  1650.         } while(root != tail);
  1651.         FreeCircularList(tail);
  1652.     }
  1653.     p -> interface_token  = Token(2);
  1654.     p -> identifier_token = Token(3);
  1655.     if (Sym(4) != NULL)
  1656.     {
  1657.         AstListNode *tail = (AstListNode *) Sym(4);
  1658.         p -> AllocateExtendsInterfaces(tail -> index + 1);
  1659.         AstListNode *root = tail;
  1660.         do
  1661.         {
  1662.             root = root -> next;
  1663.             p -> AddExtendsInterface((AstExpression *) root -> element);
  1664.         } while(root != tail);
  1665.         FreeCircularList(tail);
  1666.     }
  1667.     Sym(1) = p;
  1668. }
  1669.  
  1670. //
  1671. // Rule 112:  ExtendsInterfaces ::= extends InterfaceTypeList
  1672. //
  1673. // void SetSym1ToSym2(void);
  1674. //
  1675.  
  1676. //
  1677. // Rule 113:  InterfaceBody ::= LBRACE InterfaceMemberDeclarationsopt RBRACE
  1678. //
  1679. #line 2162 "java.g"
  1680. void Parser::Act113(void)
  1681. {
  1682.     AstInterfaceDeclaration *p = ast_pool -> NewInterfaceDeclaration();
  1683.     if (parse_header_only)
  1684.         p -> mark_unparsed();
  1685.  
  1686.     p -> left_brace_token = Token(1);
  1687.     if (Sym(2) != NULL)
  1688.     {
  1689.         int num_class_variables = 0,
  1690.             num_methods = 0,
  1691.             num_inner_classes = 0,
  1692.             num_inner_interfaces = 0,
  1693.             num_empty_declarations = 0;
  1694.  
  1695.         AstListNode *tail = (AstListNode *) Sym(2);
  1696.         p -> AllocateInterfaceMemberDeclarations(tail -> index + 1);
  1697.         AstListNode *root = tail;
  1698.         do
  1699.         {
  1700.             root = root -> next;
  1701.             p -> AddInterfaceMemberDeclaration(root -> element);
  1702.  
  1703.             AstFieldDeclaration *field_declaration = root -> element -> FieldDeclarationCast();
  1704.             if (field_declaration)
  1705.             {
  1706.                 field_declaration -> MarkStatic();
  1707.                 num_class_variables++;
  1708.             }
  1709.             else if (root -> element -> MethodDeclarationCast())
  1710.             {
  1711.                 num_methods++;
  1712.             }
  1713.             else if (root -> element -> ClassDeclarationCast())
  1714.             {
  1715.                 num_inner_classes++;
  1716.             }
  1717.             else if (root -> element -> InterfaceDeclarationCast())
  1718.             {
  1719.                 num_inner_interfaces++;
  1720.             }
  1721.             else num_empty_declarations++;
  1722.         } while(root != tail);
  1723.  
  1724.         p -> AllocateClassVariables(num_class_variables);
  1725.         p -> AllocateMethods(num_methods);
  1726.         p -> AllocateNestedClasses(num_inner_classes);
  1727.         p -> AllocateNestedInterfaces(num_inner_interfaces);
  1728.         p -> AllocateEmptyDeclarations(num_empty_declarations);
  1729.  
  1730.         root = tail;
  1731.         do
  1732.         {
  1733.             root = root -> next;
  1734.  
  1735.             AstFieldDeclaration *field_declaration;
  1736.             AstMethodDeclaration *method_declaration;
  1737.             AstClassDeclaration *class_declaration;
  1738.             AstInterfaceDeclaration *interface_declaration;
  1739.  
  1740.             if ((field_declaration = root -> element -> FieldDeclarationCast()))
  1741.             {
  1742.                 p -> AddClassVariable(field_declaration);
  1743.             }
  1744.             else if ((method_declaration = root -> element -> MethodDeclarationCast()))
  1745.             {
  1746.                 p -> AddMethod(method_declaration);
  1747.             }
  1748.             else if ((class_declaration = root -> element -> ClassDeclarationCast()))
  1749.             {
  1750.                 p -> AddNestedClass(class_declaration);
  1751.             }
  1752.             else if ((interface_declaration = root -> element -> InterfaceDeclarationCast()))
  1753.             {
  1754.                 p -> AddNestedInterface(interface_declaration);
  1755.             }
  1756.             else // assert(interface_declaration = root -> element -> EmptyDeclarationCast())
  1757.             {
  1758.                 p -> AddEmptyDeclaration((AstEmptyDeclaration *) root -> element);
  1759.             }
  1760.         } while(root != tail);
  1761.         FreeCircularList(tail);
  1762.     }
  1763.     p -> right_brace_token = Token(3);
  1764.     p -> pool = body_pool; // from now on, this is the storage pool to use for this type
  1765.     Sym(1) = p;
  1766. }
  1767.  
  1768. //
  1769. // Rule 114:  InterfaceMemberDeclarations ::= InterfaceMemberDeclaration
  1770. //
  1771. #line 2254 "java.g"
  1772. //
  1773. // Note that the list is circular so as to preserve the order of the elements
  1774. //
  1775. void Parser::Act114(void)
  1776. {
  1777.     AstListNode *p = AllocateListNode();
  1778.     p -> next = p;
  1779.     p -> element = Sym(1);
  1780.     p -> index = 0;
  1781.  
  1782.     Sym(1) = p;
  1783. }
  1784.  
  1785. //
  1786. // Rule 115:  InterfaceMemberDeclarations ::= InterfaceMemberDeclarations InterfaceMemberDeclaration
  1787. //
  1788. #line 2271 "java.g"
  1789. //
  1790. // Note that the list is circular so as to preserve the order of the elements
  1791. //
  1792. void Parser::Act115(void)
  1793. {
  1794.     AstListNode *tail = (AstListNode *) Sym(1);
  1795.  
  1796.     AstListNode *p = AllocateListNode();
  1797.     p -> element = Sym(2);
  1798.     p -> index = tail -> index + 1;
  1799.  
  1800.     p -> next = tail -> next;
  1801.     tail -> next = p;
  1802.  
  1803.     Sym(1) = p;
  1804. }
  1805.  
  1806. //
  1807. // Rule 116:  InterfaceMemberDeclaration -> ConstantDeclaration
  1808. //
  1809. // void NoAction(void);
  1810. //
  1811.  
  1812. //
  1813. // Rule 117:  InterfaceMemberDeclaration -> AbstractMethodDeclaration
  1814. //
  1815. // void NoAction(void);
  1816. //
  1817.  
  1818. //
  1819. // Rule 118:  InterfaceMemberDeclaration -> ClassDeclaration
  1820. //
  1821. // void NoAction(void);
  1822. //
  1823.  
  1824. //
  1825. // Rule 119:  InterfaceMemberDeclaration -> InterfaceDeclaration
  1826. //
  1827. // void NoAction(void);
  1828. //
  1829.  
  1830. //
  1831. // Rule 120:  InterfaceMemberDeclaration ::= SEMICOLON
  1832. //
  1833. #line 2317 "java.g"
  1834. void Parser::Act120(void)
  1835. {
  1836.     Sym(1) = ast_pool -> NewEmptyDeclaration(Token(1));
  1837. }
  1838.  
  1839. //
  1840. // Rule 121:  ConstantDeclaration -> FieldDeclaration
  1841. //
  1842. // void NoAction(void);
  1843. //
  1844.  
  1845. //
  1846. // Rule 122:  AbstractMethodDeclaration ::= MethodHeader SEMICOLON
  1847. //
  1848. #line 2330 "java.g"
  1849. void Parser::Act122(void)
  1850. {
  1851.     ((AstMethodDeclaration *) Sym(1)) -> method_body = ast_pool -> NewEmptyStatement(Token(2));
  1852. }
  1853.  
  1854. //
  1855. // Rule 123:  ArrayInitializer ::= LBRACE ,opt RBRACE
  1856. //
  1857. #line 2347 "java.g"
  1858. void Parser::Act123(void)
  1859. {
  1860.     AstArrayInitializer *p = ast_pool -> NewArrayInitializer();
  1861.     p -> left_brace_token      = Token(1);
  1862.     p -> right_brace_token     = Token(3);
  1863.     Sym(1) = p;
  1864. }
  1865.  
  1866. //
  1867. // Rule 124:  ArrayInitializer ::= LBRACE VariableInitializers RBRACE
  1868. //
  1869. #line 2359 "java.g"
  1870. void Parser::Act124(void)
  1871. {
  1872.     AstArrayInitializer *p = ast_pool -> NewArrayInitializer();
  1873.     p -> left_brace_token      = Token(1);
  1874.     if (Sym(2) != NULL)
  1875.     {
  1876.         AstListNode *tail = (AstListNode *) Sym(2);
  1877.         p -> AllocateVariableInitializers(tail -> index + 1);
  1878.         AstListNode *root = tail;
  1879.         do
  1880.         {
  1881.             root = root -> next;
  1882.             p -> AddVariableInitializer(root -> element);
  1883.         } while(root != tail);
  1884.         FreeCircularList(tail);
  1885.     }
  1886.     p -> right_brace_token     = Token(3);
  1887.     Sym(1) = p;
  1888. }
  1889.  
  1890. //
  1891. // Rule 125:  ArrayInitializer ::= LBRACE VariableInitializers COMMA RBRACE
  1892. //
  1893. #line 2383 "java.g"
  1894. void Parser::Act125(void)
  1895. {
  1896.     AstArrayInitializer *p = ast_pool -> NewArrayInitializer();
  1897.     p -> left_brace_token      = Token(1);
  1898.     if (Sym(2) != NULL)
  1899.     {
  1900.         AstListNode *tail = (AstListNode *) Sym(2);
  1901.         p -> AllocateVariableInitializers(tail -> index + 1);
  1902.         AstListNode *root = tail;
  1903.         do
  1904.         {
  1905.             root = root -> next;
  1906.             p -> AddVariableInitializer(root -> element);
  1907.         } while(root != tail);
  1908.         FreeCircularList(tail);
  1909.     }
  1910.     p -> right_brace_token     = Token(4);
  1911.     Sym(1) = p;
  1912. }
  1913.  
  1914. //
  1915. // Rule 126:  VariableInitializers ::= VariableInitializer
  1916. //
  1917. #line 2407 "java.g"
  1918. //
  1919. // Note that the list is circular so as to preserve the order of the elements
  1920. //
  1921. void Parser::Act126(void)
  1922. {
  1923.     AstListNode *p = AllocateListNode();
  1924.     p -> next = p;
  1925.     p -> element = Sym(1);
  1926.     p -> index = 0;
  1927.  
  1928.     Sym(1) = p;
  1929. }
  1930.  
  1931. //
  1932. // Rule 127:  VariableInitializers ::= VariableInitializers COMMA VariableInitializer
  1933. //
  1934. #line 2424 "java.g"
  1935. //
  1936. // Note that the list is circular so as to preserve the order of the elements
  1937. //
  1938. void Parser::Act127(void)
  1939. {
  1940.     AstListNode *tail = (AstListNode *) Sym(1);
  1941.  
  1942.     AstListNode *p = AllocateListNode();
  1943.     p -> element = Sym(3);
  1944.     p -> index = tail -> index + 1;
  1945.  
  1946.     p -> next = tail -> next;
  1947.     tail -> next = p;
  1948.  
  1949.     Sym(1) = p;
  1950. }
  1951.  
  1952. //
  1953. // Rule 128:  Block ::= LBRACE BlockStatementsopt RBRACE
  1954. //
  1955. #line 2447 "java.g"
  1956. void Parser::Act128(void)
  1957. {
  1958.     AstBlock *p = ast_pool -> NewBlock();
  1959.     p -> left_brace_token  = Token(1);
  1960.     if (Sym(2) != NULL)
  1961.     {
  1962.         AstListNode *tail = (AstListNode *) Sym(2);
  1963.         p -> AllocateBlockStatements(tail -> index + 1);
  1964.         AstListNode *root = tail;
  1965.         do
  1966.         {
  1967.             root = root -> next;
  1968.             p -> AddStatement((AstStatement *) root -> element);
  1969.         } while(root != tail);
  1970.         FreeCircularList(tail);
  1971.     }
  1972.     p -> right_brace_token = Token(3);
  1973.     Sym(1) = p;
  1974. }
  1975.  
  1976. //
  1977. // Rule 129:  BlockStatements ::= BlockStatement
  1978. //
  1979. #line 2471 "java.g"
  1980. //
  1981. // Note that the list is circular so as to preserve the order of the elements
  1982. //
  1983. void Parser::Act129(void)
  1984. {
  1985.     AstListNode *p = AllocateListNode();
  1986.     p -> next = p;
  1987.     p -> element = Sym(1);
  1988.     p -> index = 0;
  1989.  
  1990.     Sym(1) = p;
  1991. }
  1992.  
  1993. //
  1994. // Rule 130:  BlockStatements ::= BlockStatements BlockStatement
  1995. //
  1996. #line 2488 "java.g"
  1997. //
  1998. // Note that the list is circular so as to preserve the order of the elements
  1999. //
  2000. void Parser::Act130(void)
  2001. {
  2002.     AstListNode *tail = (AstListNode *) Sym(1);
  2003.  
  2004.     AstListNode *p = AllocateListNode();
  2005.     p -> element = Sym(2);
  2006.     p -> index = tail -> index + 1;
  2007.  
  2008.     p -> next = tail -> next;
  2009.     tail -> next = p;
  2010.  
  2011.     Sym(1) = p;
  2012. }
  2013.  
  2014. //
  2015. // Rule 131:  BlockStatement -> LocalVariableDeclarationStatement
  2016. //
  2017. // void NoAction(void);
  2018. //
  2019.  
  2020. //
  2021. // Rule 132:  BlockStatement -> Statement
  2022. //
  2023. // void NoAction(void);
  2024. //
  2025.  
  2026. //
  2027. // Rule 133:  BlockStatement -> ClassDeclaration
  2028. //
  2029. // void NoAction(void);
  2030. //
  2031.  
  2032. //
  2033. // Rule 134:  LocalVariableDeclarationStatement ::= LocalVariableDeclaration SEMICOLON
  2034. //
  2035. #line 2522 "java.g"
  2036. void Parser::Act134(void)
  2037. {
  2038.     ((AstLocalVariableDeclarationStatement *) Sym(1)) -> semicolon_token_opt = Token(2);
  2039. }
  2040.  
  2041. //
  2042. // Rule 135:  LocalVariableDeclaration ::= Type VariableDeclarators
  2043. //
  2044. #line 2531 "java.g"
  2045. void Parser::Act135(void)
  2046. {
  2047.     AstLocalVariableDeclarationStatement *p = ast_pool -> NewLocalVariableDeclarationStatement();
  2048.     p -> type                 = Sym(1);
  2049.     //
  2050.     // The list of declarators is guaranteed not empty
  2051.     //
  2052.     {
  2053.         AstListNode *tail = (AstListNode *) Sym(2);
  2054.         p -> AllocateVariableDeclarators(tail -> index + 1);
  2055.         AstListNode *root = tail;
  2056.         do
  2057.         {
  2058.             root = root -> next;
  2059.             p -> AddVariableDeclarator((AstVariableDeclarator *) root -> element);
  2060.         } while(root != tail);
  2061.         FreeCircularList(tail);
  2062.     }
  2063.     p -> semicolon_token_opt  = 0;
  2064.     Sym(1) = p;
  2065. }
  2066.  
  2067. //
  2068. // Rule 136:  LocalVariableDeclaration ::= Modifiers Type VariableDeclarators
  2069. //
  2070. #line 2558 "java.g"
  2071. void Parser::Act136(void)
  2072. {
  2073.     AstLocalVariableDeclarationStatement *p = ast_pool -> NewLocalVariableDeclarationStatement();
  2074.     //
  2075.     // The list of modifiers is guaranteed not empty
  2076.     //
  2077.     {
  2078.         AstListNode *tail = (AstListNode *) Sym(1);
  2079.         p -> AllocateLocalModifiers(tail -> index + 1);
  2080.         AstListNode *root = tail;
  2081.         do
  2082.         {
  2083.             root = root -> next;
  2084.             p -> AddLocalModifier((AstModifier *) root -> element);
  2085.         } while(root != tail);
  2086.         FreeCircularList(tail);
  2087.     }
  2088.     p -> type = Sym(2);
  2089.     //
  2090.     // The list of declarators is guaranteed not empty
  2091.     //
  2092.     {
  2093.         AstListNode *tail = (AstListNode *) Sym(3);
  2094.         p -> AllocateVariableDeclarators(tail -> index + 1);
  2095.         AstListNode *root = tail;
  2096.         do
  2097.         {
  2098.             root = root -> next;
  2099.             p -> AddVariableDeclarator((AstVariableDeclarator *) root -> element);
  2100.         } while(root != tail);
  2101.         FreeCircularList(tail);
  2102.     }
  2103.     p -> semicolon_token_opt  = 0;
  2104.     Sym(1) = p;
  2105. }
  2106.  
  2107. //
  2108. // Rule 137:  Statement -> StatementWithoutTrailingSubstatement
  2109. //
  2110. // void NoAction(void);
  2111. //
  2112.  
  2113. //
  2114. // Rule 138:  Statement -> LabeledStatement
  2115. //
  2116. // void NoAction(void);
  2117. //
  2118.  
  2119. //
  2120. // Rule 139:  Statement -> IfThenStatement
  2121. //
  2122. // void NoAction(void);
  2123. //
  2124.  
  2125. //
  2126. // Rule 140:  Statement -> IfThenElseStatement
  2127. //
  2128. // void NoAction(void);
  2129. //
  2130.  
  2131. //
  2132. // Rule 141:  Statement -> WhileStatement
  2133. //
  2134. // void NoAction(void);
  2135. //
  2136.  
  2137. //
  2138. // Rule 142:  Statement -> ForStatement
  2139. //
  2140. // void NoAction(void);
  2141. //
  2142.  
  2143. //
  2144. // Rule 143:  StatementNoShortIf -> StatementWithoutTrailingSubstatement
  2145. //
  2146. // void NoAction(void);
  2147. //
  2148.  
  2149. //
  2150. // Rule 144:  StatementNoShortIf -> LabeledStatementNoShortIf
  2151. //
  2152. // void NoAction(void);
  2153. //
  2154.  
  2155. //
  2156. // Rule 145:  StatementNoShortIf -> IfThenElseStatementNoShortIf
  2157. //
  2158. // void NoAction(void);
  2159. //
  2160.  
  2161. //
  2162. // Rule 146:  StatementNoShortIf -> WhileStatementNoShortIf
  2163. //
  2164. // void NoAction(void);
  2165. //
  2166.  
  2167. //
  2168. // Rule 147:  StatementNoShortIf -> ForStatementNoShortIf
  2169. //
  2170. // void NoAction(void);
  2171. //
  2172.  
  2173. //
  2174. // Rule 148:  StatementWithoutTrailingSubstatement -> Block
  2175. //
  2176. // void NoAction(void);
  2177. //
  2178.  
  2179. //
  2180. // Rule 149:  StatementWithoutTrailingSubstatement -> EmptyStatement
  2181. //
  2182. // void NoAction(void);
  2183. //
  2184.  
  2185. //
  2186. // Rule 150:  StatementWithoutTrailingSubstatement -> ExpressionStatement
  2187. //
  2188. // void NoAction(void);
  2189. //
  2190.  
  2191. //
  2192. // Rule 151:  StatementWithoutTrailingSubstatement -> SwitchStatement
  2193. //
  2194. // void NoAction(void);
  2195. //
  2196.  
  2197. //
  2198. // Rule 152:  StatementWithoutTrailingSubstatement -> DoStatement
  2199. //
  2200. // void NoAction(void);
  2201. //
  2202.  
  2203. //
  2204. // Rule 153:  StatementWithoutTrailingSubstatement -> BreakStatement
  2205. //
  2206. // void NoAction(void);
  2207. //
  2208.  
  2209. //
  2210. // Rule 154:  StatementWithoutTrailingSubstatement -> ContinueStatement
  2211. //
  2212. // void NoAction(void);
  2213. //
  2214.  
  2215. //
  2216. // Rule 155:  StatementWithoutTrailingSubstatement -> ReturnStatement
  2217. //
  2218. // void NoAction(void);
  2219. //
  2220.  
  2221. //
  2222. // Rule 156:  StatementWithoutTrailingSubstatement -> SynchronizedStatement
  2223. //
  2224. // void NoAction(void);
  2225. //
  2226.  
  2227. //
  2228. // Rule 157:  StatementWithoutTrailingSubstatement -> ThrowStatement
  2229. //
  2230. // void NoAction(void);
  2231. //
  2232.  
  2233. //
  2234. // Rule 158:  StatementWithoutTrailingSubstatement -> TryStatement
  2235. //
  2236. // void NoAction(void);
  2237. //
  2238.  
  2239. //
  2240. // Rule 159:  EmptyStatement ::= SEMICOLON
  2241. //
  2242. // void MakeEmptyStatement(void);
  2243. //
  2244.  
  2245. //
  2246. // Rule 160:  LabeledStatement ::= Identifier COLON Statement
  2247. //
  2248. #line 2693 "java.g"
  2249. void Parser::MakeLabeledStatement(void)
  2250. {
  2251.     AstBlock *p = Sym(3) -> BlockCast();
  2252.  
  2253.     if (! (p && p -> NumStatements() == 1 &&
  2254.            (p -> Statement(0) -> kind == Ast::FOR   ||
  2255.             p -> Statement(0) -> kind == Ast::WHILE ||
  2256.             p -> Statement(0) -> kind == Ast::DO)))
  2257.     {
  2258.         //
  2259.         // When a statement is labeled, it is enclosed in a block.
  2260.         // This is necessary in order to allow the same name to be
  2261.         // reused to label a subsequent statement at the same nesting
  2262.         // level... See ProcessBlock, ProcessStatement,...
  2263.         //
  2264.         p = ast_pool -> NewBlock();
  2265.         p -> AllocateBlockStatements(1); // allocate 1 element
  2266.         p -> left_brace_token  = Token(1);
  2267.         p -> AddStatement((AstStatement *) Sym(3));
  2268.         p -> right_brace_token = Sym(3) -> RightToken();
  2269.     }
  2270.  
  2271.     p -> AddLabel(Token(1)); // add label to statement
  2272.     Sym(1) = p; // The final result is a block containing the labeled-statement
  2273. }
  2274.  
  2275. //
  2276. // Rule 161:  LabeledStatementNoShortIf ::= Identifier COLON StatementNoShortIf
  2277. //
  2278. // void MakeLabeledStatement(void);
  2279. //
  2280.  
  2281. //
  2282. // Rule 162:  ExpressionStatement ::= StatementExpression SEMICOLON
  2283. //
  2284. #line 2730 "java.g"
  2285. void Parser::Act162(void)
  2286. {
  2287.     ((AstExpressionStatement *) Sym(1)) -> semicolon_token_opt = Token(2);
  2288. }
  2289.  
  2290. //
  2291. // Rule 163:  StatementExpression ::= Assignment
  2292. //
  2293. #line 2739 "java.g"
  2294. void Parser::MakeExpressionStatement(void)
  2295. {
  2296.     AstExpressionStatement *p = ast_pool -> NewExpressionStatement();
  2297.     p -> expression          = (AstExpression *) Sym(1);
  2298.     p -> semicolon_token_opt = 0;
  2299.     Sym(1) = p;
  2300. }
  2301.  
  2302. //
  2303. // Rule 164:  StatementExpression ::= PreIncrementExpression
  2304. //
  2305. // void MakeExpressionStatement(void);
  2306. //
  2307.  
  2308. //
  2309. // Rule 165:  StatementExpression ::= PreDecrementExpression
  2310. //
  2311. // void MakeExpressionStatement(void);
  2312. //
  2313.  
  2314. //
  2315. // Rule 166:  StatementExpression ::= PostIncrementExpression
  2316. //
  2317. // void MakeExpressionStatement(void);
  2318. //
  2319.  
  2320. //
  2321. // Rule 167:  StatementExpression ::= PostDecrementExpression
  2322. //
  2323. // void MakeExpressionStatement(void);
  2324. //
  2325.  
  2326. //
  2327. // Rule 168:  StatementExpression ::= MethodInvocation
  2328. //
  2329. // void MakeExpressionStatement(void);
  2330. //
  2331.  
  2332. //
  2333. // Rule 169:  StatementExpression ::= ClassInstanceCreationExpression
  2334. //
  2335. // void MakeExpressionStatement(void);
  2336. //
  2337.  
  2338. //
  2339. // Rule 170:  IfThenStatement ::= if LPAREN Expression RPAREN Statement
  2340. //
  2341. #line 2793 "java.g"
  2342. void Parser::Act170(void)
  2343. {
  2344.     AstBlock *block = Sym(5) -> BlockCast();
  2345.     if (! block)
  2346.     {
  2347.         block = ast_pool -> NewBlock();
  2348.         block -> AllocateBlockStatements(1); // allocate 1 element
  2349.         block -> left_brace_token  = Token(5);
  2350.         block -> AddStatement((AstStatement *) Sym(5));
  2351.         block -> right_brace_token = Sym(5) -> RightToken();
  2352.     }
  2353.  
  2354.     AstIfStatement *p = ast_pool -> NewIfStatement();
  2355.     p -> if_token            = Token(1);
  2356.     p -> expression          = (AstExpression *) Sym(3);
  2357.     p -> true_statement      = block;
  2358.     p -> false_statement_opt = NULL;
  2359.     Sym(1) = p;
  2360. }
  2361.  
  2362. //
  2363. // Rule 171:  IfThenElseStatement ::= if LPAREN Expression RPAREN StatementNoShortIf else Statement
  2364. //
  2365. #line 2817 "java.g"
  2366. void Parser::MakeIfThenElseStatement(void)
  2367. {
  2368.     AstBlock *true_block = Sym(5) -> BlockCast();
  2369.     if (! true_block)
  2370.     {
  2371.         true_block = ast_pool -> NewBlock();
  2372.         true_block -> AllocateBlockStatements(1); // allocate 1 element
  2373.         true_block -> left_brace_token  = Token(5);
  2374.         true_block -> AddStatement((AstStatement *) Sym(5));
  2375.         true_block -> right_brace_token = Sym(5) -> RightToken();
  2376.     }
  2377.  
  2378.     AstBlock *false_block = Sym(7) -> BlockCast();
  2379.     if (! false_block)
  2380.     {
  2381.         false_block = ast_pool -> NewBlock();
  2382.         false_block -> AllocateBlockStatements(1); // allocate 1 element
  2383.         false_block -> left_brace_token  = Token(7);
  2384.         false_block -> AddStatement((AstStatement *) Sym(7));
  2385.         false_block -> right_brace_token = Sym(7) -> RightToken();
  2386.     }
  2387.  
  2388.     AstIfStatement *p = ast_pool -> NewIfStatement();
  2389.     p -> if_token            = Token(1);
  2390.     p -> expression          = (AstExpression *) Sym(3);
  2391.     p -> true_statement      = true_block;
  2392.     p -> false_statement_opt = false_block;
  2393.     Sym(1) = p;
  2394. }
  2395.  
  2396. //
  2397. // Rule 172:  IfThenElseStatementNoShortIf ::= if LPAREN Expression RPAREN StatementNoShortIf else StatementNoShortIf
  2398. //
  2399. // void MakeIfThenElseStatement(void);
  2400. //
  2401.  
  2402. //
  2403. // Rule 173:  SwitchStatement ::= switch LPAREN Expression RPAREN SwitchBlock
  2404. //
  2405. #line 2858 "java.g"
  2406. void Parser::Act173(void)
  2407. {
  2408.     AstSwitchStatement *p = (AstSwitchStatement *) Sym(5);
  2409.     p -> switch_token = Token(1);
  2410.     p -> expression   = (AstExpression *) Sym(3);
  2411.     Sym(1) = p;
  2412. }
  2413.  
  2414. //
  2415. // Rule 174:  SwitchBlock ::= LBRACE RBRACE
  2416. //
  2417. #line 2870 "java.g"
  2418. void Parser::Act174(void)
  2419. {
  2420.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2421.  
  2422.     AstBlock *block = ast_pool -> NewBlock();
  2423.     block -> left_brace_token  = Token(1);
  2424.     block -> right_brace_token = Token(2);
  2425.  
  2426.     p -> switch_block = block;
  2427.  
  2428.     Sym(1) = p;
  2429. }
  2430.  
  2431. //
  2432. // Rule 175:  SwitchBlock ::= LBRACE SwitchBlockStatements RBRACE
  2433. //
  2434. #line 2887 "java.g"
  2435. void Parser::Act175(void)
  2436. {
  2437.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2438.  
  2439.     AstBlock *block = ast_pool -> NewBlock();
  2440.     block -> left_brace_token  = Token(1);
  2441.     if (Sym(2) != NULL)
  2442.     {
  2443.         AstListNode *tail = (AstListNode *) Sym(2);
  2444.         block -> AllocateBlockStatements(tail -> index + 1);
  2445.         AstListNode *root = tail;
  2446.         do
  2447.         {
  2448.             root = root -> next;
  2449.             block -> AddStatement((AstStatement *) root -> element);
  2450.         } while(root != tail);
  2451.         FreeCircularList(tail);
  2452.     }
  2453.     block -> right_brace_token = Token(3);
  2454.  
  2455.     p -> switch_block  = block;
  2456.  
  2457.     Sym(1) = p;
  2458. }
  2459.  
  2460. //
  2461. // Rule 176:  SwitchBlock ::= LBRACE SwitchLabels RBRACE
  2462. //
  2463. #line 2916 "java.g"
  2464. void Parser::Act176(void)
  2465. {
  2466.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2467.  
  2468.     AstSwitchBlockStatement *q = ast_pool -> NewSwitchBlockStatement();
  2469.     q -> AddStatement(ast_pool -> NewEmptyStatement(Token(Sym(2) -> RightToken())));
  2470.  
  2471.     //
  2472.     // The list of SwitchBlockStatements is never null
  2473.     //
  2474.     {
  2475.         AstListNode *tail = (AstListNode *) Sym(2);
  2476.         q -> AllocateSwitchLabels(tail -> index + 1);
  2477.         AstListNode *root = tail;
  2478.         do
  2479.         {
  2480.             root = root -> next;
  2481.             q -> AddSwitchLabel((AstStatement *) root -> element);
  2482.         } while(root != tail);
  2483.         FreeCircularList(tail);
  2484.     }
  2485.  
  2486.     AstBlock *block = ast_pool -> NewBlock();
  2487.     block -> AllocateBlockStatements(1); // allocate 1 element
  2488.     block -> left_brace_token  = Token(1);
  2489.     block -> AddStatement(q);
  2490.     block -> right_brace_token = Token(3);
  2491.  
  2492.     p -> switch_block  = block;
  2493.  
  2494.     Sym(1) = p;
  2495. }
  2496.  
  2497. //
  2498. // Rule 177:  SwitchBlock ::= LBRACE SwitchBlockStatements SwitchLabels RBRACE
  2499. //
  2500. #line 2953 "java.g"
  2501. void Parser::Act177(void)
  2502. {
  2503.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2504.  
  2505.     AstBlock *block = ast_pool -> NewBlock();
  2506.     block -> left_brace_token  = Token(1);
  2507.     //
  2508.     // The list of SwitchBlockStatements is never null
  2509.     //
  2510.     {
  2511.         AstListNode *tail = (AstListNode *) Sym(2);
  2512.         block -> AllocateBlockStatements(tail -> index + 2); // +1 because of extra statement for additional SwithLabels
  2513.         AstListNode *root = tail;
  2514.         do
  2515.         {
  2516.             root = root -> next;
  2517.             block -> AddStatement((AstStatement *) root -> element);
  2518.         } while(root != tail);
  2519.         FreeCircularList(tail);
  2520.     }
  2521.  
  2522.     AstSwitchBlockStatement *q = ast_pool -> NewSwitchBlockStatement();
  2523.     q -> AddStatement(ast_pool -> NewEmptyStatement(Token(Sym(3) -> RightToken())));
  2524.  
  2525.     //
  2526.     // The list of SwitchLabels is never null
  2527.     //
  2528.     {
  2529.         AstListNode *tail = (AstListNode *) Sym(3);
  2530.         q -> AllocateSwitchLabels(tail -> index + 1);
  2531.         AstListNode *root = tail;
  2532.         do
  2533.         {
  2534.             root = root -> next;
  2535.             q -> AddSwitchLabel(root -> element);
  2536.         } while(root != tail);
  2537.         FreeCircularList(tail);
  2538.     }
  2539.  
  2540.     block -> AddStatement(q);
  2541.     block -> right_brace_token = Token(4);
  2542.  
  2543.     p -> switch_block  = block;
  2544.  
  2545.     Sym(1) = p;
  2546. }
  2547.  
  2548. //
  2549. // Rule 178:  SwitchBlockStatements ::= SwitchBlockStatement
  2550. //
  2551. #line 3004 "java.g"
  2552. //
  2553. // Note that the list is circular so as to preserve the order of the elements
  2554. //
  2555. void Parser::Act178(void)
  2556. {
  2557.     AstListNode *p = AllocateListNode();
  2558.     p -> next = p;
  2559.     p -> element = Sym(1);
  2560.     p -> index = 0;
  2561.  
  2562.     Sym(1) = p;
  2563. }
  2564.  
  2565. //
  2566. // Rule 179:  SwitchBlockStatements ::= SwitchBlockStatements SwitchBlockStatement
  2567. //
  2568. #line 3021 "java.g"
  2569. //
  2570. // Note that the list is circular so as to preserve the order of the elements
  2571. //
  2572. void Parser::Act179(void)
  2573. {
  2574.     AstListNode *tail = (AstListNode *) Sym(1);
  2575.  
  2576.     AstListNode *p = AllocateListNode();
  2577.     p -> element = Sym(2);
  2578.     p -> index = tail -> index + 1;
  2579.  
  2580.     p -> next = tail -> next;
  2581.     tail -> next = p;
  2582.  
  2583.     Sym(1) = p;
  2584. }
  2585.  
  2586. //
  2587. // Rule 180:  SwitchBlockStatement ::= SwitchLabels BlockStatements
  2588. //
  2589. #line 3042 "java.g"
  2590. void Parser::Act180(void)
  2591. {
  2592.     AstSwitchBlockStatement *p = ast_pool -> NewSwitchBlockStatement();
  2593.     //
  2594.     // The list of SwitchLabels is never null
  2595.     //
  2596.     {
  2597.         AstListNode *tail = (AstListNode *) Sym(1);
  2598.         p -> AllocateSwitchLabels(tail -> index + 1);
  2599.         AstListNode *root = tail;
  2600.         do
  2601.         {
  2602.             root = root -> next;
  2603.             p -> AddSwitchLabel(root -> element);
  2604.         } while(root != tail);
  2605.         FreeCircularList(tail);
  2606.     }
  2607.  
  2608.     //
  2609.     // The list of SwitchBlockStatements is never null
  2610.     //
  2611.     {
  2612.         AstListNode *tail = (AstListNode *) Sym(2);
  2613.         p -> AllocateBlockStatements(tail -> index + 1);
  2614.         AstListNode *root = tail;
  2615.         do
  2616.         {
  2617.             root = root -> next;
  2618.             p -> AddStatement((AstStatement *) root -> element);
  2619.         } while(root != tail);
  2620.         FreeCircularList(tail);
  2621.     }
  2622.     Sym(1) = p;
  2623. }
  2624.  
  2625. //
  2626. // Rule 181:  SwitchLabels ::= SwitchLabel
  2627. //
  2628. #line 3081 "java.g"
  2629. //
  2630. // Note that the list is circular so as to preserve the order of the elements
  2631. //
  2632. void Parser::Act181(void)
  2633. {
  2634.     AstListNode *p = AllocateListNode();
  2635.     p -> next = p;
  2636.     p -> element = Sym(1);
  2637.     p -> index = 0;
  2638.  
  2639.     Sym(1) = p;
  2640. }
  2641.  
  2642. //
  2643. // Rule 182:  SwitchLabels ::= SwitchLabels SwitchLabel
  2644. //
  2645. #line 3098 "java.g"
  2646. //
  2647. // Note that the list is circular so as to preserve the order of the elements
  2648. //
  2649. void Parser::Act182(void)
  2650. {
  2651.     AstListNode *tail = (AstListNode *) Sym(1);
  2652.  
  2653.     AstListNode *p = AllocateListNode();
  2654.     p -> element = Sym(2);
  2655.     p -> index = tail -> index + 1;
  2656.  
  2657.     p -> next = tail -> next;
  2658.     tail -> next = p;
  2659.  
  2660.     Sym(1) = p;
  2661. }
  2662.  
  2663. //
  2664. // Rule 183:  SwitchLabel ::= case ConstantExpression COLON
  2665. //
  2666. #line 3119 "java.g"
  2667. void Parser::Act183(void)
  2668. {
  2669.     AstCaseLabel *p = ast_pool -> NewCaseLabel();
  2670.     p -> case_token  = Token(1);
  2671.     p -> expression  = (AstExpression *) Sym(2);
  2672.     p -> colon_token = Token(3);
  2673.     Sym(1) = p;
  2674. }
  2675.  
  2676. //
  2677. // Rule 184:  SwitchLabel ::= default COLON
  2678. //
  2679. #line 3132 "java.g"
  2680. void Parser::Act184(void)
  2681. {
  2682.     AstDefaultLabel *p = ast_pool -> NewDefaultLabel();
  2683.     p -> default_token = Token(1);
  2684.     p -> colon_token   = Token(2);
  2685.     Sym(1) = p;
  2686. }
  2687.  
  2688. //
  2689. // Rule 185:  WhileStatement ::= while LPAREN Expression RPAREN Statement
  2690. //
  2691. #line 3144 "java.g"
  2692. void Parser::MakeWhileStatement(void)
  2693. {
  2694.     AstWhileStatement *p = ast_pool -> NewWhileStatement();
  2695.     p -> while_token = Token(1);
  2696.     p -> expression  = (AstExpression *) Sym(3);
  2697.     p -> statement   = (AstStatement *) Sym(5);
  2698.  
  2699.     AstBlock *block = ast_pool -> NewBlock();
  2700.     block -> AllocateBlockStatements(1); // allocate 1 element
  2701.     block -> left_brace_token  = Token(1); // point to 'FOR' keyword
  2702.     block -> AddStatement(p);
  2703.     block -> right_brace_token = Sym(5) -> RightToken(); // point to last token in statement
  2704.  
  2705.     Sym(1) = block;
  2706. }
  2707.  
  2708. //
  2709. // Rule 186:  WhileStatementNoShortIf ::= while LPAREN Expression RPAREN StatementNoShortIf
  2710. //
  2711. // void MakeWhileStatement(void);
  2712. //
  2713.  
  2714. //
  2715. // Rule 187:  DoStatement ::= do Statement while LPAREN Expression RPAREN SEMICOLON
  2716. //
  2717. #line 3171 "java.g"
  2718. void Parser::Act187(void)
  2719. {
  2720.     AstDoStatement *p = ast_pool -> NewDoStatement();
  2721.     p -> do_token        = Token(1);
  2722.     p -> statement       = (AstStatement *) Sym(2);
  2723.     p -> while_token     = Token(3);
  2724.     p -> expression      = (AstExpression *) Sym(5);
  2725.     p -> semicolon_token = Token(7);
  2726.  
  2727.     AstBlock *block = ast_pool -> NewBlock();
  2728.     block -> AllocateBlockStatements(1); // allocate 1 element
  2729.     block -> left_brace_token  = Token(1);
  2730.     block -> AddStatement(p);
  2731.     block -> right_brace_token = Token(7);
  2732.  
  2733.     Sym(1) = block;
  2734. }
  2735.  
  2736. //
  2737. // Rule 188:  ForStatement ::= for LPAREN ForInitopt SEMICOLON Expressionopt SEMICOLON ForUpdateopt RPAREN Statement
  2738. //
  2739. #line 3193 "java.g"
  2740. void Parser::MakeForStatement(void)
  2741. {
  2742.     AstForStatement *p = ast_pool -> NewForStatement();
  2743.     p -> for_token = Token(1);
  2744.     if (Sym(3) != NULL)
  2745.     {
  2746.         AstListNode *tail = (AstListNode *) Sym(3);
  2747.         p -> AllocateForInitStatements(tail -> index + 1);
  2748.         AstListNode *root = tail;
  2749.         do
  2750.         {
  2751.             root = root -> next;
  2752.             p -> AddForInitStatement((AstStatement *) root -> element);
  2753.         } while(root != tail);
  2754.         FreeCircularList(tail);
  2755.     }
  2756.     p -> end_expression_opt = (AstExpression *) Sym(5);
  2757.     if (Sym(7) != NULL)
  2758.     {
  2759.         AstListNode *tail = (AstListNode *) Sym(7);
  2760.         p -> AllocateForUpdateStatements(tail -> index + 1);
  2761.         AstListNode *root = tail;
  2762.         do
  2763.         {
  2764.             root = root -> next;
  2765.             p -> AddForUpdateStatement((AstExpressionStatement *) root -> element);
  2766.         } while(root != tail);
  2767.         FreeCircularList(tail);
  2768.     }
  2769.     p -> statement = (AstStatement *) Sym(9);
  2770.  
  2771.     AstBlock *block = ast_pool -> NewBlock();
  2772.     block -> AllocateBlockStatements(1); // allocate 1 element
  2773.     block -> left_brace_token  = Token(1);
  2774.     block -> AddStatement(p);
  2775.     block -> right_brace_token = Sym(9) -> RightToken();
  2776.  
  2777.     Sym(1) = block;
  2778. }
  2779.  
  2780. //
  2781. // Rule 189:  ForStatementNoShortIf ::= for LPAREN ForInitopt SEMICOLON Expressionopt SEMICOLON ForUpdateopt RPAREN...
  2782. //
  2783. // void MakeForStatement(void);
  2784. //
  2785.  
  2786. //
  2787. // Rule 190:  ForInit -> StatementExpressionList
  2788. //
  2789. // void NoAction(void);
  2790. //
  2791.  
  2792. //
  2793. // Rule 191:  ForInit ::= LocalVariableDeclaration
  2794. //
  2795. #line 3248 "java.g"
  2796. //
  2797. // Note that the list is circular so as to preserve the order of the elements
  2798. //
  2799. void Parser::Act191(void)
  2800. {
  2801.     AstListNode *p = AllocateListNode();
  2802.     p -> next = p;
  2803.     p -> element = Sym(1);
  2804.     p -> index = 0;
  2805.  
  2806.     Sym(1) = p;
  2807. }
  2808.  
  2809. //
  2810. // Rule 192:  ForUpdate -> StatementExpressionList
  2811. //
  2812. // void NoAction(void);
  2813. //
  2814.  
  2815. //
  2816. // Rule 193:  StatementExpressionList ::= StatementExpression
  2817. //
  2818. #line 3269 "java.g"
  2819. //
  2820. // Note that the list is circular so as to preserve the order of the elements
  2821. //
  2822. void Parser::Act193(void)
  2823. {
  2824.     AstListNode *p = AllocateListNode();
  2825.     p -> next = p;
  2826.     p -> element = Sym(1);
  2827.     p -> index = 0;
  2828.  
  2829.     Sym(1) = p;
  2830. }
  2831.  
  2832. //
  2833. // Rule 194:  StatementExpressionList ::= StatementExpressionList COMMA StatementExpression
  2834. //
  2835. #line 3286 "java.g"
  2836. //
  2837. // Note that the list is circular so as to preserve the order of the elements
  2838. //
  2839. void Parser::Act194(void)
  2840. {
  2841.     AstListNode *tail = (AstListNode *) Sym(1);
  2842.  
  2843.     AstListNode *p = AllocateListNode();
  2844.     p -> element = Sym(3);
  2845.     p -> index = tail -> index + 1;
  2846.  
  2847.     p -> next = tail -> next;
  2848.     tail -> next = p;
  2849.  
  2850.     Sym(1) = p;
  2851. }
  2852.  
  2853. //
  2854. // Rule 195:  BreakStatement ::= break SEMICOLON
  2855. //
  2856. #line 3313 "java.g"
  2857. void Parser::Act195(void)
  2858. {
  2859.     AstBreakStatement *p = ast_pool -> NewBreakStatement();
  2860.     p -> break_token          = Token(1);
  2861.     p -> identifier_token_opt = 0;
  2862.     p -> semicolon_token      = Token(2);
  2863.     Sym(1) = p;
  2864. }
  2865.  
  2866. //
  2867. // Rule 196:  BreakStatement ::= break Identifier SEMICOLON
  2868. //
  2869. #line 3326 "java.g"
  2870. void Parser::Act196(void)
  2871. {
  2872.     AstBreakStatement *p = ast_pool -> NewBreakStatement();
  2873.     p -> break_token          = Token(1);
  2874.     p -> identifier_token_opt = Token(2);
  2875.     p -> semicolon_token      = Token(3);
  2876.     Sym(1) = p;
  2877. }
  2878.  
  2879. //
  2880. // Rule 197:  ContinueStatement ::= continue SEMICOLON
  2881. //
  2882. #line 3339 "java.g"
  2883. void Parser::Act197(void)
  2884. {
  2885.     AstContinueStatement *p = ast_pool -> NewContinueStatement();
  2886.     p -> continue_token       = Token(1);
  2887.     p -> identifier_token_opt = 0;
  2888.     p -> semicolon_token      = Token(2);
  2889.     Sym(1) = p;
  2890. }
  2891.  
  2892. //
  2893. // Rule 198:  ContinueStatement ::= continue Identifier SEMICOLON
  2894. //
  2895. #line 3352 "java.g"
  2896. void Parser::Act198(void)
  2897. {
  2898.     AstContinueStatement *p = ast_pool -> NewContinueStatement();
  2899.     p -> continue_token       = Token(1);
  2900.     p -> identifier_token_opt = Token(2);
  2901.     p -> semicolon_token      = Token(3);
  2902.     Sym(1) = p;
  2903. }
  2904.  
  2905. //
  2906. // Rule 199:  ReturnStatement ::= return Expressionopt SEMICOLON
  2907. //
  2908. #line 3365 "java.g"
  2909. void Parser::Act199(void)
  2910. {
  2911.     AstReturnStatement *p = ast_pool -> NewReturnStatement();
  2912.     p -> return_token    = Token(1);
  2913.     p -> expression_opt  = (AstExpression *) Sym(2);
  2914.     p -> semicolon_token = Token(3);
  2915.     Sym(1) = p;
  2916. }
  2917.  
  2918. //
  2919. // Rule 200:  ThrowStatement ::= throw Expression SEMICOLON
  2920. //
  2921. #line 3378 "java.g"
  2922. void Parser::Act200(void)
  2923. {
  2924.     AstThrowStatement *p = ast_pool -> NewThrowStatement();
  2925.     p -> throw_token     = Token(1);
  2926.     p -> expression      = (AstExpression *) Sym(2);
  2927.     p -> semicolon_token = Token(3);
  2928.     Sym(1) = p;
  2929. }
  2930.  
  2931. //
  2932. // Rule 201:  SynchronizedStatement ::= synchronized LPAREN Expression RPAREN Block
  2933. //
  2934. #line 3391 "java.g"
  2935. void Parser::Act201(void)
  2936. {
  2937.     AstSynchronizedStatement *p = ast_pool -> NewSynchronizedStatement();
  2938.     p -> synchronized_token = Token(1);
  2939.     p -> expression         = (AstExpression *) Sym(3);
  2940.     p -> block              = (AstBlock *) Sym(5);
  2941.     p -> block -> block_tag = AstBlock::SYNCHRONIZED;
  2942.  
  2943.     Sym(1) = p;
  2944. }
  2945.  
  2946. //
  2947. // Rule 202:  TryStatement ::= try Block Catches
  2948. //
  2949. #line 3406 "java.g"
  2950. void Parser::Act202(void)
  2951. {
  2952.     AstTryStatement *p = ast_pool -> NewTryStatement();
  2953.     p -> try_token          = Token(1);
  2954.     p -> block              = (AstBlock *) Sym(2);
  2955.  
  2956.     //
  2957.     // The list of modifiers is guaranteed not empty
  2958.     //
  2959.     {
  2960.         AstListNode *tail = (AstListNode *) Sym(3);
  2961.         p -> AllocateCatchClauses(tail -> index + 1);
  2962.         AstListNode *root = tail;
  2963.         do
  2964.         {
  2965.             root = root -> next;
  2966.             p -> AddCatchClause((AstCatchClause *) root -> element);
  2967.         } while(root != tail);
  2968.         FreeCircularList(tail);
  2969.     }
  2970.     p -> finally_clause_opt = NULL;
  2971.     Sym(1) = p;
  2972. }
  2973.  
  2974. //
  2975. // Rule 203:  TryStatement ::= try Block Catchesopt Finally
  2976. //
  2977. #line 3434 "java.g"
  2978. void Parser::Act203(void)
  2979. {
  2980.     AstTryStatement *p = ast_pool -> NewTryStatement();
  2981.     p -> try_token      = Token(1);
  2982.     p -> block          = (AstBlock *) Sym(2);
  2983.     p -> block -> block_tag = AstBlock::TRY_CLAUSE_WITH_FINALLY;
  2984.  
  2985.     if (Sym(3) != NULL)
  2986.     {
  2987.         AstListNode *tail = (AstListNode *) Sym(3);
  2988.         p -> AllocateCatchClauses(tail -> index + 1);
  2989.         AstListNode *root = tail;
  2990.         do
  2991.         {
  2992.             root = root -> next;
  2993.             p -> AddCatchClause((AstCatchClause *) root -> element);
  2994.         } while(root != tail);
  2995.         FreeCircularList(tail);
  2996.     }
  2997.  
  2998.     for (int i = 0; i < p -> NumCatchClauses(); i++)
  2999.         p -> CatchClause(i) -> block -> block_tag = AstBlock::TRY_CLAUSE_WITH_FINALLY;
  3000.  
  3001.     p -> finally_clause_opt = (AstFinallyClause *) Sym(4);
  3002.  
  3003.     Sym(1) = p;
  3004. }
  3005.  
  3006. //
  3007. // Rule 204:  Catches ::= CatchClause
  3008. //
  3009. #line 3466 "java.g"
  3010. //
  3011. // Note that the list is circular so as to preserve the order of the elements
  3012. //
  3013. void Parser::Act204(void)
  3014. {
  3015.     AstListNode *p = AllocateListNode();
  3016.     p -> next = p;
  3017.     p -> element = Sym(1);
  3018.     p -> index = 0;
  3019.  
  3020.     Sym(1) = p;
  3021. }
  3022.  
  3023. //
  3024. // Rule 205:  Catches ::= Catches CatchClause
  3025. //
  3026. #line 3483 "java.g"
  3027. //
  3028. // Note that the list is circular so as to preserve the order of the elements
  3029. //
  3030. void Parser::Act205(void)
  3031. {
  3032.     AstListNode *tail = (AstListNode *) Sym(1);
  3033.  
  3034.     AstListNode *p = AllocateListNode();
  3035.     p -> element = Sym(2);
  3036.     p -> index = tail -> index + 1;
  3037.  
  3038.     p -> next = tail -> next;
  3039.     tail -> next = p;
  3040.  
  3041.     Sym(1) = p;
  3042. }
  3043.  
  3044. //
  3045. // Rule 206:  CatchClause ::= catch LPAREN FormalParameter RPAREN Block
  3046. //
  3047. #line 3504 "java.g"
  3048. void Parser::Act206(void)
  3049. {
  3050.     AstCatchClause *p = ast_pool -> NewCatchClause();
  3051.     p -> catch_token      = Token(1);
  3052.     p -> formal_parameter = (AstFormalParameter *) Sym(3);
  3053.     p -> block            = (AstBlock *) Sym(5);
  3054.  
  3055.     Sym(1) = p;
  3056. }
  3057.  
  3058. //
  3059. // Rule 207:  Finally ::= finally Block
  3060. //
  3061. #line 3518 "java.g"
  3062. void Parser::Act207(void)
  3063. {
  3064.     AstFinallyClause *p     = ast_pool -> NewFinallyClause();
  3065.     p -> finally_token      = Token(1);
  3066.     p -> block              = (AstBlock *) Sym(2);
  3067.     p -> block -> block_tag = AstBlock::FINALLY;
  3068.  
  3069.     Sym(1) = p;
  3070. }
  3071.  
  3072. //
  3073. // Rule 208:  Primary -> PrimaryNoNewArray
  3074. //
  3075. // void NoAction(void);
  3076. //
  3077.  
  3078. //
  3079. // Rule 209:  Primary -> ArrayCreationExpression
  3080. //
  3081. // void NoAction(void);
  3082. //
  3083.  
  3084. //
  3085. // Rule 210:  PrimaryNoNewArray -> Literal
  3086. //
  3087. // void NoAction(void);
  3088. //
  3089.  
  3090. //
  3091. // Rule 211:  PrimaryNoNewArray ::= this
  3092. //
  3093. #line 3546 "java.g"
  3094. void Parser::Act211(void)
  3095. {
  3096.     Sym(1) = ast_pool -> NewThisExpression(Token(1));
  3097. }
  3098.  
  3099. //
  3100. // Rule 212:  PrimaryNoNewArray ::= LPAREN Expression RPAREN
  3101. //
  3102. #line 3555 "java.g"
  3103. void Parser::Act212(void)
  3104. {
  3105.     AstParenthesizedExpression *p = ast_pool -> NewParenthesizedExpression();
  3106.     p -> left_parenthesis_token = Token(1);
  3107.     p -> expression = (AstExpression *) Sym(2);
  3108.     p -> right_parenthesis_token = Token(3);
  3109.     Sym(1) = p;
  3110. }
  3111.  
  3112. //
  3113. // Rule 213:  PrimaryNoNewArray -> ClassInstanceCreationExpression
  3114. //
  3115. // void NoAction(void);
  3116. //
  3117.  
  3118. //
  3119. // Rule 214:  PrimaryNoNewArray -> FieldAccess
  3120. //
  3121. // void NoAction(void);
  3122. //
  3123.  
  3124. //
  3125. // Rule 215:  PrimaryNoNewArray ::= Name DOT this
  3126. //
  3127. #line 3577 "java.g"
  3128. void Parser::Act215(void)
  3129. {
  3130.     AstFieldAccess *p = ast_pool -> NewFieldAccess(AstFieldAccess::THIS_TAG);
  3131.     p -> base = (AstExpression *) Sym(1);
  3132.     p -> dot_token = Token(2);
  3133.     p -> identifier_token = Token(3);
  3134.     Sym(1) = p;
  3135. }
  3136.  
  3137. //
  3138. // Rule 216:  PrimaryNoNewArray ::= Type DOT class
  3139. //
  3140. #line 3591 "java.g"
  3141. void Parser::Act216(void)
  3142. {
  3143.     AstFieldAccess *p = ast_pool -> NewFieldAccess(AstFieldAccess::CLASS_TAG);
  3144.     p -> base = ast_pool -> NewTypeExpression(Sym(1));
  3145.     p -> dot_token = Token(2);
  3146.     p -> identifier_token = Token(3);
  3147.     Sym(1) = p;
  3148. }
  3149.  
  3150. //
  3151. // Rule 217:  PrimaryNoNewArray ::= void DOT class
  3152. //
  3153. #line 3605 "java.g"
  3154. void Parser::Act217(void)
  3155. {
  3156.     AstFieldAccess *p = ast_pool -> NewFieldAccess(AstFieldAccess::CLASS_TAG);
  3157.     p -> base = ast_pool -> NewTypeExpression(ast_pool -> NewPrimitiveType(Ast::VOID_TYPE, Token(1)));
  3158.     p -> dot_token = Token(2);
  3159.     p -> identifier_token = Token(3);
  3160.     Sym(1) = p;
  3161. }
  3162.  
  3163. //
  3164. // Rule 218:  PrimaryNoNewArray -> MethodInvocation
  3165. //
  3166. // void NoAction(void);
  3167. //
  3168.  
  3169. //
  3170. // Rule 219:  PrimaryNoNewArray -> ArrayAccess
  3171. //
  3172. // void NoAction(void);
  3173. //
  3174.  
  3175. //
  3176. // Rule 220:  ClassInstanceCreationExpression ::= new ClassType LPAREN ArgumentListopt RPAREN ClassBodyopt
  3177. //
  3178. #line 3631 "java.g"
  3179. void Parser::Act220(void)
  3180. {
  3181.     AstClassInstanceCreationExpression *p = ast_pool -> NewClassInstanceCreationExpression();
  3182.     p -> base_opt                = NULL;
  3183.     p -> dot_token_opt           = 0;
  3184.     p -> new_token               = Token(1);
  3185.     p -> class_type              = ast_pool -> NewTypeExpression(Sym(2));
  3186.     p -> left_parenthesis_token  = Token(3);
  3187.     if (Sym(4) != NULL)
  3188.     {
  3189.         AstListNode *tail = (AstListNode *) Sym(4);
  3190.         p -> AllocateArguments(tail -> index + 1);
  3191.         AstListNode *root = tail;
  3192.         do
  3193.         {
  3194.             root = root -> next;
  3195.             p -> AddArgument((AstExpression *) root -> element);
  3196.         } while(root != tail);
  3197.         FreeCircularList(tail);
  3198.     }
  3199.     p -> right_parenthesis_token = Token(5);
  3200.     p -> class_body_opt          = (AstClassBody *) Sym(6);
  3201.     Sym(1) = p;
  3202. }
  3203.  
  3204. //
  3205. // Rule 221:  ClassInstanceCreationExpression ::= Primary DOT new SimpleName LPAREN ArgumentListopt RPAREN ClassBodyopt
  3206. //
  3207. #line 3661 "java.g"
  3208. void Parser::MakeQualifiedNew(void)
  3209. {
  3210.     AstClassInstanceCreationExpression *p = ast_pool -> NewClassInstanceCreationExpression();
  3211.     p -> base_opt                = (AstExpression *) Sym(1);
  3212.     p -> dot_token_opt           = Token(2);
  3213.     p -> new_token               = Token(3);
  3214.     p -> class_type              = ast_pool -> NewTypeExpression(Sym(4));
  3215.     p -> left_parenthesis_token  = Token(5);
  3216.     if (Sym(6) != NULL)
  3217.     {
  3218.         AstListNode *tail = (AstListNode *) Sym(6);
  3219.         p -> AllocateArguments(tail -> index + 1);
  3220.         AstListNode *root = tail;
  3221.         do
  3222.         {
  3223.             root = root -> next;
  3224.             p -> AddArgument((AstExpression *) root -> element);
  3225.         } while(root != tail);
  3226.         FreeCircularList(tail);
  3227.     }
  3228.     p -> right_parenthesis_token = Token(7);
  3229.     p -> class_body_opt          = (AstClassBody *) Sym(8);
  3230.     Sym(1) = p;
  3231. }
  3232.  
  3233. //
  3234. // Rule 222:  ClassInstanceCreationExpression ::= Name DOT new SimpleName LPAREN ArgumentListopt RPAREN ClassBodyopt
  3235. //
  3236. // void MakeQualifiedNew(void);
  3237. //
  3238.  
  3239. //
  3240. // Rule 223:  ArgumentList ::= Expression
  3241. //
  3242. #line 3698 "java.g"
  3243. //
  3244. // Note that the list is circular so as to preserve the order of the elements
  3245. //
  3246. void Parser::Act223(void)
  3247. {
  3248.     AstListNode *p = AllocateListNode();
  3249.     p -> next = p;
  3250.     p -> element = Sym(1);
  3251.     p -> index = 0;
  3252.  
  3253.     Sym(1) = p;
  3254. }
  3255.  
  3256. //
  3257. // Rule 224:  ArgumentList ::= ArgumentList COMMA Expression
  3258. //
  3259. #line 3715 "java.g"
  3260. //
  3261. // Note that the list is circular so as to preserve the order of the elements
  3262. //
  3263. void Parser::Act224(void)
  3264. {
  3265.     AstListNode *tail = (AstListNode *) Sym(1);
  3266.  
  3267.     AstListNode *p = AllocateListNode();
  3268.     p -> element = Sym(3);
  3269.     p -> index = tail -> index + 1;
  3270.  
  3271.     p -> next = tail -> next;
  3272.     tail -> next = p;
  3273.  
  3274.     Sym(1) = p;
  3275. }
  3276.  
  3277. //
  3278. // Rule 225:  ArrayCreationExpression ::= new PrimitiveType DimExprs Dimsopt
  3279. //
  3280. #line 3736 "java.g"
  3281. void Parser::MakeArrayCreationExpression(void)
  3282. {
  3283.     AstArrayCreationExpression *p = ast_pool -> NewArrayCreationExpression();
  3284.     p -> new_token             = Token(1);
  3285.     p -> array_type            = Sym(2);
  3286.     //
  3287.     // The list of DimExprs is never null
  3288.     //
  3289.     {
  3290.         AstListNode *tail = (AstListNode *) Sym(3);
  3291.         p -> AllocateDimExprs(tail -> index + 1);
  3292.         AstListNode *root = tail;
  3293.         do
  3294.         {
  3295.             root = root -> next;
  3296.             p -> AddDimExpr((AstDimExpr *) root -> element);
  3297.         } while(root != tail);
  3298.         FreeCircularList(tail);
  3299.     }
  3300.  
  3301.     if (Sym(4) != NULL)
  3302.     {
  3303.         AstListNode *tail = (AstListNode *) Sym(4);
  3304.         p -> AllocateBrackets(tail -> index + 1);
  3305.         AstListNode *root = tail;
  3306.         do
  3307.         {
  3308.             root = root -> next;
  3309.             p -> AddBrackets((AstBrackets *) root -> element);
  3310.         } while(root != tail);
  3311.         FreeCircularList(tail);
  3312.     }
  3313.     p -> array_initializer_opt = NULL;
  3314.     Sym(1) = p;
  3315. }
  3316.  
  3317. //
  3318. // Rule 226:  ArrayCreationExpression ::= new ClassOrInterfaceType DimExprs Dimsopt
  3319. //
  3320. // void MakeArrayCreationExpression(void);
  3321. //
  3322.  
  3323. //
  3324. // Rule 227:  ArrayCreationExpression ::= new ArrayType ArrayInitializer
  3325. //
  3326. #line 3784 "java.g"
  3327. void Parser::Act227(void)
  3328. {
  3329.     AstArrayCreationExpression *p = ast_pool -> NewArrayCreationExpression();
  3330.     p -> new_token             = Token(1);
  3331.     p -> array_type            = Sym(2);
  3332.     p -> array_initializer_opt = (AstArrayInitializer *) Sym(3);
  3333.     Sym(1) = p;
  3334. }
  3335.  
  3336. //
  3337. // Rule 228:  DimExprs ::= DimExpr
  3338. //
  3339. #line 3797 "java.g"
  3340. //
  3341. // Note that the list is circular so as to preserve the order of the elements
  3342. //
  3343. void Parser::Act228(void)
  3344. {
  3345.     AstListNode *p = AllocateListNode();
  3346.     p -> next = p;
  3347.     p -> element = Sym(1);
  3348.     p -> index = 0;
  3349.  
  3350.     Sym(1) = p;
  3351. }
  3352.  
  3353. //
  3354. // Rule 229:  DimExprs ::= DimExprs DimExpr
  3355. //
  3356. #line 3814 "java.g"
  3357. //
  3358. // Note that the list is circular so as to preserve the order of the elements
  3359. //
  3360. void Parser::Act229(void)
  3361. {
  3362.     AstListNode *tail = (AstListNode *) Sym(1);
  3363.  
  3364.     AstListNode *p = AllocateListNode();
  3365.     p -> element = Sym(2);
  3366.     p -> index = tail -> index + 1;
  3367.  
  3368.     p -> next = tail -> next;
  3369.     tail -> next = p;
  3370.  
  3371.     Sym(1) = p;
  3372. }
  3373.  
  3374. //
  3375. // Rule 230:  DimExpr ::= LBRACKET Expression RBRACKET
  3376. //
  3377. #line 3835 "java.g"
  3378. void Parser::Act230(void)
  3379. {
  3380.     AstDimExpr *p = ast_pool -> NewDimExpr();
  3381.     p -> left_bracket_token  = Token(1);
  3382.     p -> expression          = (AstExpression *) Sym(2);
  3383.     p -> right_bracket_token = Token(3);
  3384.     Sym(1) = p;
  3385. }
  3386.  
  3387. //
  3388. // Rule 231:  Dims ::= LBRACKET RBRACKET
  3389. //
  3390. #line 3848 "java.g"
  3391. //
  3392. // Note that the list is circular so as to preserve the order of the elements
  3393. //
  3394. void Parser::Act231(void)
  3395. {
  3396.     AstListNode *p = AllocateListNode();
  3397.     p -> next = p;
  3398.     p -> element = ast_pool -> NewBrackets(Token(1), Token(2));
  3399.     p -> index = 0;
  3400.  
  3401.     Sym(1) = p;
  3402. }
  3403.  
  3404. //
  3405. // Rule 232:  Dims ::= Dims LBRACKET RBRACKET
  3406. //
  3407. #line 3865 "java.g"
  3408. //
  3409. // Note that the list is circular so as to preserve the order of the elements
  3410. //
  3411. void Parser::Act232(void)
  3412. {
  3413.     AstListNode *tail = (AstListNode *) Sym(1);
  3414.  
  3415.     AstListNode *p = AllocateListNode();
  3416.     p -> element = ast_pool -> NewBrackets(Token(2), Token(3));
  3417.     p -> index = tail -> index + 1;
  3418.  
  3419.     p -> next = tail -> next;
  3420.     tail -> next = p;
  3421.  
  3422.     Sym(1) = p;
  3423. }
  3424.  
  3425. //
  3426. // Rule 233:  FieldAccess ::= Primary DOT Identifier
  3427. //
  3428. // void MakeFieldAccess(void);
  3429. //
  3430.  
  3431. //
  3432. // Rule 234:  FieldAccess ::= super DOT Identifier
  3433. //
  3434. #line 3893 "java.g"
  3435. void Parser::MakeSuperFieldAccess(void)
  3436. {
  3437.     Sym(1) = ast_pool -> NewSuperExpression(Token(1));
  3438.  
  3439.     MakeFieldAccess();
  3440. }
  3441.  
  3442. //
  3443. // Rule 235:  FieldAccess ::= Name DOT super DOT Identifier
  3444. //
  3445. #line 3905 "java.g"
  3446. void Parser::MakeSuperDoubleFieldAccess(void)
  3447. {
  3448.     AstFieldAccess *p = ast_pool -> NewFieldAccess();
  3449.  
  3450.          AstFieldAccess *q = ast_pool -> NewFieldAccess(AstFieldAccess::SUPER_TAG);
  3451.          q -> base = (AstExpression *) Sym(1);
  3452.          q -> dot_token = Token(2);
  3453.          q -> identifier_token = Token(3);
  3454.  
  3455.     p -> base = q;
  3456.     p -> dot_token = Token(4);
  3457.     p -> identifier_token = Token(5);
  3458.  
  3459.     Sym(1) = p;
  3460. }
  3461.  
  3462. //
  3463. // Rule 236:  MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN
  3464. //
  3465. #line 3925 "java.g"
  3466. void Parser::Act236(void)
  3467. {
  3468.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3469.     p -> method                  = (AstExpression *) Sym(1);
  3470.     p -> left_parenthesis_token  = Token(2);
  3471.     if (Sym(3) != NULL)
  3472.     {
  3473.         AstListNode *tail = (AstListNode *) Sym(3);
  3474.         p -> AllocateArguments(tail -> index + 1);
  3475.         AstListNode *root = tail;
  3476.         do
  3477.         {
  3478.             root = root -> next;
  3479.             p -> AddArgument((AstExpression *) root -> element);
  3480.         } while(root != tail);
  3481.         FreeCircularList(tail);
  3482.     }
  3483.     p -> right_parenthesis_token = Token(4);
  3484.     Sym(1) = p;
  3485. }
  3486.  
  3487. //
  3488. // Rule 237:  MethodInvocation ::= Primary DOT Identifier LPAREN ArgumentListopt RPAREN
  3489. //
  3490. #line 3950 "java.g"
  3491. void Parser::Act237(void)
  3492. {
  3493.     MakeFieldAccess();
  3494.  
  3495.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3496.     p -> method                  = (AstExpression *) Sym(1);
  3497.     p -> left_parenthesis_token  = Token(4);
  3498.     if (Sym(5) != NULL)
  3499.     {
  3500.         AstListNode *tail = (AstListNode *) Sym(5);
  3501.         p -> AllocateArguments(tail -> index + 1);
  3502.         AstListNode *root = tail;
  3503.         do
  3504.         {
  3505.             root = root -> next;
  3506.             p -> AddArgument((AstExpression *) root -> element);
  3507.         } while(root != tail);
  3508.         FreeCircularList(tail);
  3509.     }
  3510.     p -> right_parenthesis_token = Token(6);
  3511.     Sym(1) = p;
  3512. }
  3513.  
  3514. //
  3515. // Rule 238:  MethodInvocation ::= super DOT Identifier LPAREN ArgumentListopt RPAREN
  3516. //
  3517. #line 3977 "java.g"
  3518. void Parser::Act238(void)
  3519. {
  3520.     MakeSuperFieldAccess();
  3521.  
  3522.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3523.     p -> method                  = (AstExpression *) Sym(1);
  3524.     p -> left_parenthesis_token  = Token(4);
  3525.     if (Sym(5) != NULL)
  3526.     {
  3527.         AstListNode *tail = (AstListNode *) Sym(5);
  3528.         p -> AllocateArguments(tail -> index + 1);
  3529.         AstListNode *root = tail;
  3530.         do
  3531.         {
  3532.             root = root -> next;
  3533.             p -> AddArgument((AstExpression *) root -> element);
  3534.         } while(root != tail);
  3535.         FreeCircularList(tail);
  3536.     }
  3537.     p -> right_parenthesis_token = Token(6);
  3538.     Sym(1) = p;
  3539. }
  3540.  
  3541. //
  3542. // Rule 239:  MethodInvocation ::= Name DOT super DOT Identifier LPAREN ArgumentListopt RPAREN
  3543. //
  3544. #line 4005 "java.g"
  3545. void Parser::Act239(void)
  3546. {
  3547.     MakeSuperDoubleFieldAccess();
  3548.  
  3549.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3550.     p -> method                  = (AstExpression *) Sym(1);
  3551.     p -> left_parenthesis_token  = Token(6);
  3552.     if (Sym(7) != NULL)
  3553.     {
  3554.         AstListNode *tail = (AstListNode *) Sym(7);
  3555.         p -> AllocateArguments(tail -> index + 1);
  3556.         AstListNode *root = tail;
  3557.         do
  3558.         {
  3559.             root = root -> next;
  3560.             p -> AddArgument((AstExpression *) root -> element);
  3561.         } while(root != tail);
  3562.         FreeCircularList(tail);
  3563.     }
  3564.     p -> right_parenthesis_token = Token(8);
  3565.     Sym(1) = p;
  3566. }
  3567.  
  3568. //
  3569. // Rule 240:  ArrayAccess ::= Name LBRACKET Expression RBRACKET
  3570. //
  3571. #line 4032 "java.g"
  3572. void Parser::MakeArrayAccess(void)
  3573. {
  3574.     AstArrayAccess *p = ast_pool -> NewArrayAccess();
  3575.     p -> base                = (AstExpression *) Sym(1);
  3576.     p -> left_bracket_token  = Token(2);
  3577.     p -> expression          = (AstExpression *) Sym(3);
  3578.     p -> right_bracket_token = Token(4);
  3579.     Sym(1) = p;
  3580. }
  3581.  
  3582. //
  3583. // Rule 241:  ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression RBRACKET
  3584. //
  3585. // void MakeArrayAccess(void);
  3586. //
  3587.  
  3588. //
  3589. // Rule 242:  PostfixExpression -> Primary
  3590. //
  3591. // void NoAction(void);
  3592. //
  3593.  
  3594. //
  3595. // Rule 243:  PostfixExpression -> Name
  3596. //
  3597. // void NoAction(void);
  3598. //
  3599.  
  3600. //
  3601. // Rule 244:  PostfixExpression -> PostIncrementExpression
  3602. //
  3603. // void NoAction(void);
  3604. //
  3605.  
  3606. //
  3607. // Rule 245:  PostfixExpression -> PostDecrementExpression
  3608. //
  3609. // void NoAction(void);
  3610. //
  3611.  
  3612. //
  3613. // Rule 246:  PostIncrementExpression ::= PostfixExpression PLUS_PLUS
  3614. //
  3615. #line 4069 "java.g"
  3616. void Parser::Act246(void)
  3617. {
  3618.     AstPostUnaryExpression *p = ast_pool -> NewPostUnaryExpression(AstPostUnaryExpression::PLUSPLUS);
  3619.     p -> expression          = (AstExpression *) Sym(1);
  3620.     p -> post_operator_token = Token(2);
  3621.     Sym(1) = p;
  3622. }
  3623.  
  3624. //
  3625. // Rule 247:  PostDecrementExpression ::= PostfixExpression MINUS_MINUS
  3626. //
  3627. #line 4081 "java.g"
  3628. void Parser::Act247(void)
  3629. {
  3630.     AstPostUnaryExpression *p = ast_pool -> NewPostUnaryExpression(AstPostUnaryExpression::MINUSMINUS);
  3631.     p -> expression          = (AstExpression *) Sym(1);
  3632.     p -> post_operator_token = Token(2);
  3633.     Sym(1) = p;
  3634. }
  3635.  
  3636. //
  3637. // Rule 248:  UnaryExpression -> PreIncrementExpression
  3638. //
  3639. // void NoAction(void);
  3640. //
  3641.  
  3642. //
  3643. // Rule 249:  UnaryExpression -> PreDecrementExpression
  3644. //
  3645. // void NoAction(void);
  3646. //
  3647.  
  3648. //
  3649. // Rule 250:  UnaryExpression ::= PLUS UnaryExpression
  3650. //
  3651. #line 4101 "java.g"
  3652. void Parser::Act250(void)
  3653. {
  3654.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::PLUS);
  3655.     p -> pre_operator_token = Token(1);
  3656.     p -> expression         = (AstExpression *) Sym(2);
  3657.     Sym(1) = p;
  3658. }
  3659.  
  3660. //
  3661. // Rule 251:  UnaryExpression ::= MINUS UnaryExpression
  3662. //
  3663. #line 4113 "java.g"
  3664. void Parser::Act251(void)
  3665. {
  3666.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::MINUS);
  3667.     p -> pre_operator_token = Token(1);
  3668.     p -> expression         = (AstExpression *) Sym(2);
  3669.     Sym(1) = p;
  3670. }
  3671.  
  3672. //
  3673. // Rule 252:  UnaryExpression -> UnaryExpressionNotPlusMinus
  3674. //
  3675. // void NoAction(void);
  3676. //
  3677.  
  3678. //
  3679. // Rule 253:  PreIncrementExpression ::= PLUS_PLUS UnaryExpression
  3680. //
  3681. #line 4129 "java.g"
  3682. void Parser::Act253(void)
  3683. {
  3684.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::PLUSPLUS);
  3685.     p -> pre_operator_token = Token(1);
  3686.     p -> expression         = (AstExpression *) Sym(2);
  3687.     Sym(1) = p;
  3688. }
  3689.  
  3690. //
  3691. // Rule 254:  PreDecrementExpression ::= MINUS_MINUS UnaryExpression
  3692. //
  3693. #line 4141 "java.g"
  3694. void Parser::Act254(void)
  3695. {
  3696.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::MINUSMINUS);
  3697.     p -> pre_operator_token = Token(1);
  3698.     p -> expression         = (AstExpression *) Sym(2);
  3699.     Sym(1) = p;
  3700. }
  3701.  
  3702. //
  3703. // Rule 255:  UnaryExpressionNotPlusMinus -> PostfixExpression
  3704. //
  3705. // void NoAction(void);
  3706. //
  3707.  
  3708. //
  3709. // Rule 256:  UnaryExpressionNotPlusMinus ::= TWIDDLE UnaryExpression
  3710. //
  3711. #line 4157 "java.g"
  3712. void Parser::Act256(void)
  3713. {
  3714.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::TWIDDLE);
  3715.     p -> pre_operator_token = Token(1);
  3716.     p -> expression         = (AstExpression *) Sym(2);
  3717.     Sym(1) = p;
  3718. }
  3719.  
  3720. //
  3721. // Rule 257:  UnaryExpressionNotPlusMinus ::= NOT UnaryExpression
  3722. //
  3723. #line 4169 "java.g"
  3724. void Parser::Act257(void)
  3725. {
  3726.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::NOT);
  3727.     p -> pre_operator_token = Token(1);
  3728.     p -> expression         = (AstExpression *) Sym(2);
  3729.     Sym(1) = p;
  3730. }
  3731.  
  3732. //
  3733. // Rule 258:  UnaryExpressionNotPlusMinus -> CastExpression
  3734. //
  3735. // void NoAction(void);
  3736. //
  3737.  
  3738. //
  3739. // Rule 259:  CastExpression ::= LPAREN PrimitiveType Dimsopt RPAREN UnaryExpression
  3740. //
  3741. #line 4185 "java.g"
  3742. void Parser::MakeCastExpression(void)
  3743. {
  3744.     AstCastExpression *p = ast_pool -> NewCastExpression();
  3745.     p -> left_parenthesis_token_opt  = Token(1);
  3746.     p -> type_opt                    = Sym(2);
  3747.     if (Sym(3) != NULL)
  3748.     {
  3749.         AstListNode *tail = (AstListNode *) Sym(3);
  3750.         p -> AllocateBrackets(tail -> index + 1);
  3751.         AstListNode *root = tail;
  3752.         do
  3753.         {
  3754.             root = root -> next;
  3755.             p -> AddBrackets((AstBrackets *) root -> element);
  3756.         } while(root != tail);
  3757.         FreeCircularList(tail);
  3758.     }
  3759.     p -> right_parenthesis_token_opt = Token(4);
  3760.     p -> expression                  = (AstExpression *) Sym(5);
  3761.     Sym(1) = p;
  3762. }
  3763.  
  3764. //
  3765. // Rule 260:  CastExpression ::= LPAREN Expression RPAREN UnaryExpressionNotPlusMinus
  3766. //
  3767. #line 4211 "java.g"
  3768. void Parser::Act260(void)
  3769. {
  3770.     //
  3771.     // Note that Expression must be a name - i.e., Sym(2) -> isName() == true
  3772.     // This check is not performed here and should be performed during
  3773.     // semantic processing.
  3774.     //
  3775.     AstCastExpression *p = ast_pool -> NewCastExpression();
  3776.     p -> left_parenthesis_token_opt  = Token(1);
  3777.     p -> type_opt                    = Sym(2);
  3778.     p -> right_parenthesis_token_opt = Token(3);
  3779.     p -> expression                  = (AstExpression *) Sym(4);
  3780.     Sym(1) = p;
  3781. }
  3782.  
  3783. //
  3784. // Rule 261:  CastExpression ::= LPAREN Name Dims RPAREN UnaryExpressionNotPlusMinus
  3785. //
  3786. // void MakeCastExpression(void);
  3787. //
  3788.  
  3789. //
  3790. // Rule 262:  MultiplicativeExpression -> UnaryExpression
  3791. //
  3792. // void NoAction(void);
  3793. //
  3794.  
  3795. //
  3796. // Rule 263:  MultiplicativeExpression ::= MultiplicativeExpression MULTIPLY UnaryExpression
  3797. //
  3798. #line 4241 "java.g"
  3799. void Parser::Act263(void)
  3800. {
  3801.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::STAR);
  3802.     p -> left_expression       = (AstExpression *) Sym(1);
  3803.     p -> binary_operator_token = Token(2);
  3804.     p -> right_expression      = (AstExpression *) Sym(3);
  3805.     Sym(1) = p;
  3806. }
  3807.  
  3808. //
  3809. // Rule 264:  MultiplicativeExpression ::= MultiplicativeExpression DIVIDE UnaryExpression
  3810. //
  3811. #line 4254 "java.g"
  3812. void Parser::Act264(void)
  3813. {
  3814.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::SLASH);
  3815.     p -> left_expression       = (AstExpression *) Sym(1);
  3816.     p -> binary_operator_token = Token(2);
  3817.     p -> right_expression      = (AstExpression *) Sym(3);
  3818.     Sym(1) = p;
  3819. }
  3820.  
  3821. //
  3822. // Rule 265:  MultiplicativeExpression ::= MultiplicativeExpression REMAINDER UnaryExpression
  3823. //
  3824. #line 4267 "java.g"
  3825. void Parser::Act265(void)
  3826. {
  3827.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::MOD);
  3828.     p -> left_expression       = (AstExpression *) Sym(1);
  3829.     p -> binary_operator_token = Token(2);
  3830.     p -> right_expression      = (AstExpression *) Sym(3);
  3831.     Sym(1) = p;
  3832. }
  3833.  
  3834. //
  3835. // Rule 266:  AdditiveExpression -> MultiplicativeExpression
  3836. //
  3837. // void NoAction(void);
  3838. //
  3839.  
  3840. //
  3841. // Rule 267:  AdditiveExpression ::= AdditiveExpression PLUS MultiplicativeExpression
  3842. //
  3843. #line 4284 "java.g"
  3844. void Parser::Act267(void)
  3845. {
  3846.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::PLUS);
  3847.     p -> left_expression       = (AstExpression *) Sym(1);
  3848.     p -> binary_operator_token = Token(2);
  3849.     p -> right_expression      = (AstExpression *) Sym(3);
  3850.     Sym(1) = p;
  3851. }
  3852.  
  3853. //
  3854. // Rule 268:  AdditiveExpression ::= AdditiveExpression MINUS MultiplicativeExpression
  3855. //
  3856. #line 4297 "java.g"
  3857. void Parser::Act268(void)
  3858. {
  3859.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::MINUS);
  3860.     p -> left_expression       = (AstExpression *) Sym(1);
  3861.     p -> binary_operator_token = Token(2);
  3862.     p -> right_expression      = (AstExpression *) Sym(3);
  3863.     Sym(1) = p;
  3864. }
  3865.  
  3866. //
  3867. // Rule 269:  ShiftExpression -> AdditiveExpression
  3868. //
  3869. // void NoAction(void);
  3870. //
  3871.  
  3872. //
  3873. // Rule 270:  ShiftExpression ::= ShiftExpression LEFT_SHIFT AdditiveExpression
  3874. //
  3875. #line 4314 "java.g"
  3876. void Parser::Act270(void)
  3877. {
  3878.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::LEFT_SHIFT);
  3879.     p -> left_expression       = (AstExpression *) Sym(1);
  3880.     p -> binary_operator_token = Token(2);
  3881.     p -> right_expression      = (AstExpression *) Sym(3);
  3882.     Sym(1) = p;
  3883. }
  3884.  
  3885. //
  3886. // Rule 271:  ShiftExpression ::= ShiftExpression RIGHT_SHIFT AdditiveExpression
  3887. //
  3888. #line 4327 "java.g"
  3889. void Parser::Act271(void)
  3890. {
  3891.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::RIGHT_SHIFT);
  3892.     p -> left_expression       = (AstExpression *) Sym(1);
  3893.     p -> binary_operator_token = Token(2);
  3894.     p -> right_expression      = (AstExpression *) Sym(3);
  3895.     Sym(1) = p;
  3896. }
  3897.  
  3898. //
  3899. // Rule 272:  ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT AdditiveExpression
  3900. //
  3901. #line 4340 "java.g"
  3902. void Parser::Act272(void)
  3903. {
  3904.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::UNSIGNED_RIGHT_SHIFT);
  3905.     p -> left_expression       = (AstExpression *) Sym(1);
  3906.     p -> binary_operator_token = Token(2);
  3907.     p -> right_expression      = (AstExpression *) Sym(3);
  3908.     Sym(1) = p;
  3909. }
  3910.  
  3911. //
  3912. // Rule 273:  RelationalExpression -> ShiftExpression
  3913. //
  3914. // void NoAction(void);
  3915. //
  3916.  
  3917. //
  3918. // Rule 274:  RelationalExpression ::= RelationalExpression LESS ShiftExpression
  3919. //
  3920. #line 4357 "java.g"
  3921. void Parser::Act274(void)
  3922. {
  3923.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::LESS);
  3924.     p -> left_expression       = (AstExpression *) Sym(1);
  3925.     p -> binary_operator_token = Token(2);
  3926.     p -> right_expression      = (AstExpression *) Sym(3);
  3927.     Sym(1) = p;
  3928. }
  3929.  
  3930. //
  3931. // Rule 275:  RelationalExpression ::= RelationalExpression GREATER ShiftExpression
  3932. //
  3933. #line 4370 "java.g"
  3934. void Parser::Act275(void)
  3935. {
  3936.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::GREATER);
  3937.     p -> left_expression       = (AstExpression *) Sym(1);
  3938.     p -> binary_operator_token = Token(2);
  3939.     p -> right_expression      = (AstExpression *) Sym(3);
  3940.     Sym(1) = p;
  3941. }
  3942.  
  3943. //
  3944. // Rule 276:  RelationalExpression ::= RelationalExpression LESS_EQUAL ShiftExpression
  3945. //
  3946. #line 4383 "java.g"
  3947. void Parser::Act276(void)
  3948. {
  3949.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::LESS_EQUAL);
  3950.     p -> left_expression       = (AstExpression *) Sym(1);
  3951.     p -> binary_operator_token = Token(2);
  3952.     p -> right_expression      = (AstExpression *) Sym(3);
  3953.     Sym(1) = p;
  3954. }
  3955.  
  3956. //
  3957. // Rule 277:  RelationalExpression ::= RelationalExpression GREATER_EQUAL ShiftExpression
  3958. //
  3959. #line 4396 "java.g"
  3960. void Parser::Act277(void)
  3961. {
  3962.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::GREATER_EQUAL);
  3963.     p -> left_expression       = (AstExpression *) Sym(1);
  3964.     p -> binary_operator_token = Token(2);
  3965.     p -> right_expression      = (AstExpression *) Sym(3);
  3966.     Sym(1) = p;
  3967. }
  3968.  
  3969. //
  3970. // Rule 278:  RelationalExpression ::= RelationalExpression instanceof ReferenceType
  3971. //
  3972. #line 4409 "java.g"
  3973. void Parser::Act278(void)
  3974. {
  3975.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::INSTANCEOF);
  3976.     p -> left_expression       = (AstExpression *) Sym(1);
  3977.     p -> binary_operator_token = Token(2);
  3978.     p -> right_expression      = ast_pool -> NewTypeExpression(Sym(3));
  3979.     Sym(1) = p;
  3980. }
  3981.  
  3982. //
  3983. // Rule 279:  EqualityExpression -> RelationalExpression
  3984. //
  3985. // void NoAction(void);
  3986. //
  3987.  
  3988. //
  3989. // Rule 280:  EqualityExpression ::= EqualityExpression EQUAL_EQUAL RelationalExpression
  3990. //
  3991. #line 4426 "java.g"
  3992. void Parser::Act280(void)
  3993. {
  3994.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::EQUAL_EQUAL);
  3995.     p -> left_expression       = (AstExpression *) Sym(1);
  3996.     p -> binary_operator_token = Token(2);
  3997.     p -> right_expression      = (AstExpression *) Sym(3);
  3998.     Sym(1) = p;
  3999. }
  4000.  
  4001. //
  4002. // Rule 281:  EqualityExpression ::= EqualityExpression NOT_EQUAL RelationalExpression
  4003. //
  4004. #line 4439 "java.g"
  4005. void Parser::Act281(void)
  4006. {
  4007.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::NOT_EQUAL);
  4008.     p -> left_expression       = (AstExpression *) Sym(1);
  4009.     p -> binary_operator_token = Token(2);
  4010.     p -> right_expression      = (AstExpression *) Sym(3);
  4011.     Sym(1) = p;
  4012. }
  4013.  
  4014. //
  4015. // Rule 282:  AndExpression -> EqualityExpression
  4016. //
  4017. // void NoAction(void);
  4018. //
  4019.  
  4020. //
  4021. // Rule 283:  AndExpression ::= AndExpression AND EqualityExpression
  4022. //
  4023. #line 4457 "java.g"
  4024. void Parser::Act283(void)
  4025. {
  4026.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::AND);
  4027.     p -> left_expression       = (AstExpression *) Sym(1);
  4028.     p -> binary_operator_token = Token(2);
  4029.     p -> right_expression      = (AstExpression *) Sym(3);
  4030.     Sym(1) = p;
  4031. }
  4032.  
  4033. //
  4034. // Rule 284:  ExclusiveOrExpression -> AndExpression
  4035. //
  4036. // void NoAction(void);
  4037. //
  4038.  
  4039. //
  4040. // Rule 285:  ExclusiveOrExpression ::= ExclusiveOrExpression XOR AndExpression
  4041. //
  4042. #line 4474 "java.g"
  4043. void Parser::Act285(void)
  4044. {
  4045.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::XOR);
  4046.     p -> left_expression       = (AstExpression *) Sym(1);
  4047.     p -> binary_operator_token = Token(2);
  4048.     p -> right_expression      = (AstExpression *) Sym(3);
  4049.     Sym(1) = p;
  4050. }
  4051.  
  4052. //
  4053. // Rule 286:  InclusiveOrExpression -> ExclusiveOrExpression
  4054. //
  4055. // void NoAction(void);
  4056. //
  4057.  
  4058. //
  4059. // Rule 287:  InclusiveOrExpression ::= InclusiveOrExpression OR ExclusiveOrExpression
  4060. //
  4061. #line 4491 "java.g"
  4062. void Parser::Act287(void)
  4063. {
  4064.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::IOR);
  4065.     p -> left_expression       = (AstExpression *) Sym(1);
  4066.     p -> binary_operator_token = Token(2);
  4067.     p -> right_expression      = (AstExpression *) Sym(3);
  4068.     Sym(1) = p;
  4069. }
  4070.  
  4071. //
  4072. // Rule 288:  ConditionalAndExpression -> InclusiveOrExpression
  4073. //
  4074. // void NoAction(void);
  4075. //
  4076.  
  4077. //
  4078. // Rule 289:  ConditionalAndExpression ::= ConditionalAndExpression AND_AND InclusiveOrExpression
  4079. //
  4080. #line 4508 "java.g"
  4081. void Parser::Act289(void)
  4082. {
  4083.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::AND_AND);
  4084.     p -> left_expression       = (AstExpression *) Sym(1);
  4085.     p -> binary_operator_token = Token(2);
  4086.     p -> right_expression      = (AstExpression *) Sym(3);
  4087.     Sym(1) = p;
  4088. }
  4089.  
  4090. //
  4091. // Rule 290:  ConditionalOrExpression -> ConditionalAndExpression
  4092. //
  4093. // void NoAction(void);
  4094. //
  4095.  
  4096. //
  4097. // Rule 291:  ConditionalOrExpression ::= ConditionalOrExpression OR_OR ConditionalAndExpression
  4098. //
  4099. #line 4525 "java.g"
  4100. void Parser::Act291(void)
  4101. {
  4102.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::OR_OR);
  4103.     p -> left_expression       = (AstExpression *) Sym(1);
  4104.     p -> binary_operator_token = Token(2);
  4105.     p -> right_expression      = (AstExpression *) Sym(3);
  4106.     Sym(1) = p;
  4107. }
  4108.  
  4109. //
  4110. // Rule 292:  ConditionalExpression -> ConditionalOrExpression
  4111. //
  4112. // void NoAction(void);
  4113. //
  4114.  
  4115. //
  4116. // Rule 293:  ConditionalExpression ::= ConditionalOrExpression QUESTION Expression COLON ConditionalExpression
  4117. //
  4118. #line 4542 "java.g"
  4119. void Parser::Act293(void)
  4120. {
  4121.     AstConditionalExpression *p = ast_pool -> NewConditionalExpression();
  4122.     p -> test_expression  = (AstExpression *) Sym(1);
  4123.     p -> question_token   = Token(2);
  4124.     p -> true_expression  = (AstExpression *) Sym(3);
  4125.     p -> colon_token      = Token(4);
  4126.     p -> false_expression = (AstExpression *) Sym(5);
  4127.     Sym(1) = p;
  4128. }
  4129.  
  4130. //
  4131. // Rule 294:  AssignmentExpression -> ConditionalExpression
  4132. //
  4133. // void NoAction(void);
  4134. //
  4135.  
  4136. //
  4137. // Rule 295:  AssignmentExpression -> Assignment
  4138. //
  4139. // void NoAction(void);
  4140. //
  4141.  
  4142. //
  4143. // Rule 296:  Assignment ::= LeftHandSide AssignmentOperator AssignmentExpression
  4144. //
  4145. #line 4565 "java.g"
  4146. void Parser::Act296(void)
  4147. {
  4148.     AstAssignmentExpression *p = (AstAssignmentExpression *) Sym(2);
  4149.     p -> left_hand_side = (AstExpression *) Sym(1);
  4150.     p -> expression     = (AstExpression *) Sym(3);
  4151.     Sym(1) = p;
  4152. }
  4153.  
  4154. //
  4155. // Rule 297:  LeftHandSide -> Name
  4156. //
  4157. // void NoAction(void);
  4158. //
  4159.  
  4160. //
  4161. // Rule 298:  LeftHandSide -> FieldAccess
  4162. //
  4163. // void NoAction(void);
  4164. //
  4165.  
  4166. //
  4167. // Rule 299:  LeftHandSide -> ArrayAccess
  4168. //
  4169. // void NoAction(void);
  4170. //
  4171.  
  4172. //
  4173. // Rule 300:  AssignmentOperator ::= EQUAL
  4174. //
  4175. #line 4589 "java.g"
  4176. void Parser::Act300(void)
  4177. {
  4178.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::SIMPLE_EQUAL, Token(1));
  4179. }
  4180.  
  4181. //
  4182. // Rule 301:  AssignmentOperator ::= MULTIPLY_EQUAL
  4183. //
  4184. #line 4598 "java.g"
  4185. void Parser::Act301(void)
  4186. {
  4187.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::STAR_EQUAL, Token(1));
  4188. }
  4189.  
  4190. //
  4191. // Rule 302:  AssignmentOperator ::= DIVIDE_EQUAL
  4192. //
  4193. #line 4607 "java.g"
  4194. void Parser::Act302(void)
  4195. {
  4196.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::SLASH_EQUAL, Token(1));
  4197. }
  4198.  
  4199. //
  4200. // Rule 303:  AssignmentOperator ::= REMAINDER_EQUAL
  4201. //
  4202. #line 4616 "java.g"
  4203. void Parser::Act303(void)
  4204. {
  4205.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::MOD_EQUAL, Token(1));
  4206. }
  4207.  
  4208. //
  4209. // Rule 304:  AssignmentOperator ::= PLUS_EQUAL
  4210. //
  4211. #line 4625 "java.g"
  4212. void Parser::Act304(void)
  4213. {
  4214.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::PLUS_EQUAL, Token(1));
  4215. }
  4216.  
  4217. //
  4218. // Rule 305:  AssignmentOperator ::= MINUS_EQUAL
  4219. //
  4220. #line 4634 "java.g"
  4221. void Parser::Act305(void)
  4222. {
  4223.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::MINUS_EQUAL, Token(1));
  4224. }
  4225.  
  4226. //
  4227. // Rule 306:  AssignmentOperator ::= LEFT_SHIFT_EQUAL
  4228. //
  4229. #line 4643 "java.g"
  4230. void Parser::Act306(void)
  4231. {
  4232.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::LEFT_SHIFT_EQUAL, Token(1));
  4233. }
  4234.  
  4235. //
  4236. // Rule 307:  AssignmentOperator ::= RIGHT_SHIFT_EQUAL
  4237. //
  4238. #line 4652 "java.g"
  4239. void Parser::Act307(void)
  4240. {
  4241.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::RIGHT_SHIFT_EQUAL, Token(1));
  4242. }
  4243.  
  4244. //
  4245. // Rule 308:  AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL
  4246. //
  4247. #line 4661 "java.g"
  4248. void Parser::Act308(void)
  4249. {
  4250.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::UNSIGNED_RIGHT_SHIFT_EQUAL, Token(1));
  4251. }
  4252.  
  4253. //
  4254. // Rule 309:  AssignmentOperator ::= AND_EQUAL
  4255. //
  4256. #line 4670 "java.g"
  4257. void Parser::Act309(void)
  4258. {
  4259.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::AND_EQUAL, Token(1));
  4260. }
  4261.  
  4262. //
  4263. // Rule 310:  AssignmentOperator ::= XOR_EQUAL
  4264. //
  4265. #line 4679 "java.g"
  4266. void Parser::Act310(void)
  4267. {
  4268.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::XOR_EQUAL, Token(1));
  4269. }
  4270.  
  4271. //
  4272. // Rule 311:  AssignmentOperator ::= OR_EQUAL
  4273. //
  4274. #line 4688 "java.g"
  4275. void Parser::Act311(void)
  4276. {
  4277.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::IOR_EQUAL, Token(1));
  4278. }
  4279.  
  4280. //
  4281. // Rule 312:  Expression -> AssignmentExpression
  4282. //
  4283. // void NoAction(void);
  4284. //
  4285.  
  4286. //
  4287. // Rule 313:  ConstantExpression -> Expression
  4288. //
  4289. // void NoAction(void);
  4290. //
  4291.  
  4292. //
  4293. // Rule 314:  PackageDeclarationopt ::=
  4294. //
  4295. #line 4711 "java.g"
  4296. //
  4297. // Given a rule of the form A ::= x1 x2 ... xn
  4298. //
  4299. // Construct a NULL Ast for A.
  4300. //
  4301. void Parser::NullAction(void) { Sym(1) = NULL; }
  4302.  
  4303. //
  4304. // Rule 315:  PackageDeclarationopt -> PackageDeclaration
  4305. //
  4306. // void NoAction(void);
  4307. //
  4308.  
  4309. //
  4310. // Rule 316:  Superopt ::=
  4311. //
  4312. // void NullAction(void);
  4313. //
  4314.  
  4315. //
  4316. // Rule 317:  Superopt -> Super
  4317. //
  4318. // void NoAction(void);
  4319. //
  4320.  
  4321. //
  4322. // Rule 318:  Expressionopt ::=
  4323. //
  4324. // void NullAction(void);
  4325. //
  4326.  
  4327. //
  4328. // Rule 319:  Expressionopt -> Expression
  4329. //
  4330. // void NoAction(void);
  4331. //
  4332.  
  4333. //
  4334. // Rule 320:  ClassBodyopt ::=
  4335. //
  4336. // void NullAction(void);
  4337. //
  4338.  
  4339. //
  4340. // Rule 321:  ClassBodyopt -> ClassBody
  4341. //
  4342. // void NoAction(void);
  4343. //
  4344.  
  4345. //
  4346. // Rule 322:  ,opt ::=
  4347. //
  4348. // void NullAction(void);
  4349. //
  4350.  
  4351. //
  4352. // Rule 323:  ,opt -> COMMA
  4353. //
  4354. // void NoAction(void);
  4355. //
  4356.  
  4357. //
  4358. // Rule 324:  ImportDeclarationsopt ::=
  4359. //
  4360. // void NullAction(void);
  4361. //
  4362.  
  4363. //
  4364. // Rule 325:  ImportDeclarationsopt -> ImportDeclarations
  4365. //
  4366. // void NoAction(void);
  4367. //
  4368.  
  4369. //
  4370. // Rule 326:  TypeDeclarationsopt ::=
  4371. //
  4372. // void NullAction(void);
  4373. //
  4374.  
  4375. //
  4376. // Rule 327:  TypeDeclarationsopt -> TypeDeclarations
  4377. //
  4378. // void NoAction(void);
  4379. //
  4380.  
  4381. //
  4382. // Rule 328:  ClassBodyDeclarationsopt ::=
  4383. //
  4384. // void NullAction(void);
  4385. //
  4386.  
  4387. //
  4388. // Rule 329:  ClassBodyDeclarationsopt -> ClassBodyDeclarations
  4389. //
  4390. // void NoAction(void);
  4391. //
  4392.  
  4393. //
  4394. // Rule 330:  Modifiersopt ::=
  4395. //
  4396. // void NullAction(void);
  4397. //
  4398.  
  4399. //
  4400. // Rule 331:  Modifiersopt -> Modifiers
  4401. //
  4402. // void NoAction(void);
  4403. //
  4404.  
  4405. //
  4406. // Rule 332:  BlockStatementsopt ::=
  4407. //
  4408. // void NullAction(void);
  4409. //
  4410.  
  4411. //
  4412. // Rule 333:  BlockStatementsopt -> BlockStatements
  4413. //
  4414. // void NoAction(void);
  4415. //
  4416.  
  4417. //
  4418. // Rule 334:  Dimsopt ::=
  4419. //
  4420. // void NullAction(void);
  4421. //
  4422.  
  4423. //
  4424. // Rule 335:  Dimsopt -> Dims
  4425. //
  4426. // void NoAction(void);
  4427. //
  4428.  
  4429. //
  4430. // Rule 336:  ArgumentListopt ::=
  4431. //
  4432. // void NullAction(void);
  4433. //
  4434.  
  4435. //
  4436. // Rule 337:  ArgumentListopt -> ArgumentList
  4437. //
  4438. // void NoAction(void);
  4439. //
  4440.  
  4441. //
  4442. // Rule 338:  Throwsopt ::=
  4443. //
  4444. // void NullAction(void);
  4445. //
  4446.  
  4447. //
  4448. // Rule 339:  Throwsopt -> Throws
  4449. //
  4450. // void NoAction(void);
  4451. //
  4452.  
  4453. //
  4454. // Rule 340:  FormalParameterListopt ::=
  4455. //
  4456. // void NullAction(void);
  4457. //
  4458.  
  4459. //
  4460. // Rule 341:  FormalParameterListopt -> FormalParameterList
  4461. //
  4462. // void NoAction(void);
  4463. //
  4464.  
  4465. //
  4466. // Rule 342:  Interfacesopt ::=
  4467. //
  4468. // void NullAction(void);
  4469. //
  4470.  
  4471. //
  4472. // Rule 343:  Interfacesopt -> Interfaces
  4473. //
  4474. // void NoAction(void);
  4475. //
  4476.  
  4477. //
  4478. // Rule 344:  InterfaceMemberDeclarationsopt ::=
  4479. //
  4480. // void NullAction(void);
  4481. //
  4482.  
  4483. //
  4484. // Rule 345:  InterfaceMemberDeclarationsopt -> InterfaceMemberDeclarations
  4485. //
  4486. // void NoAction(void);
  4487. //
  4488.  
  4489. //
  4490. // Rule 346:  ForInitopt ::=
  4491. //
  4492. // void NullAction(void);
  4493. //
  4494.  
  4495. //
  4496. // Rule 347:  ForInitopt -> ForInit
  4497. //
  4498. // void NoAction(void);
  4499. //
  4500.  
  4501. //
  4502. // Rule 348:  ForUpdateopt ::=
  4503. //
  4504. // void NullAction(void);
  4505. //
  4506.  
  4507. //
  4508. // Rule 349:  ForUpdateopt -> ForUpdate
  4509. //
  4510. // void NoAction(void);
  4511. //
  4512.  
  4513. //
  4514. // Rule 350:  ExtendsInterfacesopt ::=
  4515. //
  4516. // void NullAction(void);
  4517. //
  4518.  
  4519. //
  4520. // Rule 351:  ExtendsInterfacesopt -> ExtendsInterfaces
  4521. //
  4522. // void NoAction(void);
  4523. //
  4524.  
  4525. //
  4526. // Rule 352:  Catchesopt ::=
  4527. //
  4528. // void NullAction(void);
  4529. //
  4530.  
  4531. //
  4532. // Rule 353:  Catchesopt -> Catches
  4533. //
  4534. // void NoAction(void);
  4535. //
  4536.  
  4537. //
  4538. // Rule 354:  PackageHeaderMarker ::=
  4539. //
  4540. #line 4892 "java.g"
  4541. //
  4542. // When this function is invoked, if the "parse_package_header_only" flag
  4543. // is turned on, we skip to the end-of-file token.
  4544. //
  4545. void Parser::Act354(void)
  4546. {
  4547.     if (parse_package_header_only)
  4548.         lex_stream -> Reset(lex_stream -> NumTokens() - 1); // point to the EOF token
  4549.     Sym(1) = NULL;
  4550. }
  4551.  
  4552. //
  4553. // Rule 355:  MethodHeaderMarker ::=
  4554. //
  4555. #line 4907 "java.g"
  4556. //
  4557. // When this function is invoked, if the "parse_header_only" flag
  4558. // is turned on, the body of the method being parsed is skipped.
  4559. //
  4560. void Parser::Act355(void)
  4561. {
  4562.     if (parse_header_only)
  4563.     {
  4564.         TokenObject token = Token(1);
  4565.  
  4566.         //
  4567.         // If the first token immediately following the method header
  4568.         // is not an open brace, then we have a syntactic error. Do
  4569.         // nothing and let the error recovery take care of it.
  4570.         //
  4571.         if (lex_stream -> Kind(token) == TK_LBRACE)
  4572.             lex_stream -> Reset(lex_stream -> MatchingBrace(token));
  4573.     }
  4574.  
  4575.     Sym(1) = NULL;
  4576. }
  4577.